summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2023-05-03 21:11:47 -0400
committerseth <[email protected]>2023-05-03 21:11:47 -0400
commitcf5647129499df68ac092b55b71a3cddc3422d01 (patch)
treef7685c8540cbab2bc51f87a2e9cda214d7d2dfae
parentcdfc4ba1b2ef2b187e076a6f627e4631b6bd7fb3 (diff)
refactor flake + make virtualisation compatible with 22.11
-rw-r--r--flake.lock21
-rw-r--r--flake.nix140
-rw-r--r--flake/ci.nix52
-rw-r--r--flake/configs.nix28
-rw-r--r--flake/default.nix14
-rw-r--r--flake/dev.nix47
-rw-r--r--hosts/default.nix3
-rw-r--r--modules/nixos/default.nix2
-rw-r--r--modules/nixos/virtualisation.nix1
9 files changed, 145 insertions, 163 deletions
diff --git a/flake.lock b/flake.lock
index 77001bd..2fcd4ec 100644
--- a/flake.lock
+++ b/flake.lock
@@ -279,26 +279,6 @@
"type": "github"
}
},
- "haumea": {
- "inputs": {
- "nixpkgs": [
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1683133372,
- "narHash": "sha256-rTZazktrmQ6HVQchrQPGLA4QgxC1ulla1ajt/WMNL+Y=",
- "owner": "nix-community",
- "repo": "haumea",
- "rev": "30cce612bd12b653d11bb89cf03d93403eca6f0b",
- "type": "github"
- },
- "original": {
- "owner": "nix-community",
- "repo": "haumea",
- "type": "github"
- }
- },
"hercules-ci-agent": {
"inputs": {
"flake-parts": [
@@ -616,7 +596,6 @@
"flake-utils": "flake-utils",
"getchoo": "getchoo",
"guzzle_api": "guzzle_api",
- "haumea": "haumea",
"hercules-ci-agent": "hercules-ci-agent",
"hercules-ci-effects": "hercules-ci-effects",
"home-manager": "home-manager",
diff --git a/flake.nix b/flake.nix
index 159c75e..ff7040d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -40,10 +40,6 @@
inputs.nixpkgs.follows = "nixpkgsUnstable";
inputs.pre-commit-hooks.follows = "pre-commit-hooks";
};
- haumea = {
- url = "github:nix-community/haumea";
- inputs.nixpkgs.follows = "nixpkgs";
- };
hercules-ci-agent = {
url = "github:hercules-ci/hercules-ci-agent";
inputs.nixpkgs.follows = "nixpkgsUnstable";
@@ -97,138 +93,6 @@
};
};
- outputs = inputs @ {
- self,
- flake-parts,
- getchoo,
- haumea,
- hercules-ci-effects,
- nixpkgs,
- nixinate,
- openwrt-imagebuilder,
- pre-commit-hooks,
- ragenix,
- ...
- }: let
- inherit (getchooLib.configs) mapHMUsers mapHosts;
-
- getchooLib = with inputs; let
- args = {
- users = with haumea.lib;
- load {
- src = ./users;
- loader = loaders.path;
- };
- };
- in
- getchoo.lib (inputs // args);
- in
- flake-parts.lib.mkFlake {inherit inputs;} {
- imports = [
- hercules-ci-effects.flakeModule
- ];
-
- flake = {
- nixosConfigurations = mapHosts ./hosts;
-
- nixosModules.getchoo = import ./modules;
- };
-
- hercules-ci = {
- flake-update = {
- enable = true;
- when = {
- hour = [0];
- minute = 0;
- };
- };
- };
-
- herculesCI = let
- inherit (import (hercules-ci-effects + "/vendor/hercules-ci-agent/default-herculesCI-for-flake.nix")) flakeToOutputs;
- in rec {
- ciSystems = [
- "x86_64-linux"
- "aarch64-linux"
- ];
-
- onPush = {
- default = {
- outputs = with builtins;
- with nixpkgs.lib; let
- # use defaults, but only evaluate hosts
- defaults =
- removeAttrs
- (flakeToOutputs self {
- ciSystems = genAttrs ciSystems (_: {});
- })
- ["nixosConfigurations" "packages"];
-
- evaluate = mapAttrs (_: v:
- seq
- v.config.system.build.toplevel
- v._module.args.pkgs.emptyFile)
- self.nixosConfigurations;
- in
- mkForce (defaults // evaluate);
- };
- };
- };
-
- systems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
- ];
-
- perSystem = {
- pkgs,
- system,
- ...
- }: {
- apps = (nixinate.nixinate.${system} self).nixinate;
- checks = {
- pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
- src = ./.;
- hooks = {
- actionlint.enable = true;
- alejandra.enable = true;
- deadnix.enable = true;
- statix.enable = true;
- stylua.enable = true;
- };
- };
- };
-
- devShells = let
- inherit (pkgs) mkShell;
- in {
- default = mkShell {
- inherit (self.checks.${system}.pre-commit-check) shellHook;
- packages = with inputs;
- with pkgs; [
- actionlint
- ragenix.packages.${system}.ragenix
- alejandra
- deadnix
- fzf
- git-crypt
- just
- statix
- stylua
- ];
- };
- };
-
- formatter = pkgs.alejandra;
-
- legacyPackages.homeConfigurations = mapHMUsers system ./users;
-
- packages = with inputs;
- with pkgs; {
- turret = callPackage ./hosts/_turret {inherit openwrt-imagebuilder;};
- };
- };
- };
+ outputs = inputs @ {flake-parts, ...}:
+ flake-parts.lib.mkFlake {inherit inputs;} {imports = [./flake];};
}
diff --git a/flake/ci.nix b/flake/ci.nix
new file mode 100644
index 0000000..3959260
--- /dev/null
+++ b/flake/ci.nix
@@ -0,0 +1,52 @@
+{
+ inputs,
+ self,
+ ...
+}: let
+ inherit (inputs) hercules-ci-effects nixpkgs;
+in {
+ imports = [
+ hercules-ci-effects.flakeModule
+ ];
+
+ hercules-ci = {
+ flake-update = {
+ enable = true;
+ when = {
+ hour = [0];
+ minute = 0;
+ };
+ };
+ };
+
+ herculesCI = let
+ inherit (import (hercules-ci-effects + "/vendor/hercules-ci-agent/default-herculesCI-for-flake.nix")) flakeToOutputs;
+ in rec {
+ ciSystems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ ];
+
+ onPush = {
+ default = {
+ outputs = with builtins;
+ with nixpkgs.lib; let
+ # use defaults, but only evaluate hosts
+ defaults =
+ removeAttrs
+ (flakeToOutputs self {
+ ciSystems = genAttrs ciSystems (_: {});
+ })
+ ["nixosConfigurations" "packages"];
+
+ evaluate = mapAttrs (_: v:
+ seq
+ v.config.system.build.toplevel
+ v._module.args.pkgs.emptyFile)
+ self.nixosConfigurations;
+ in
+ mkForce (defaults // evaluate);
+ };
+ };
+ };
+}
diff --git a/flake/configs.nix b/flake/configs.nix
new file mode 100644
index 0000000..9660616
--- /dev/null
+++ b/flake/configs.nix
@@ -0,0 +1,28 @@
+{
+ inputs,
+ self,
+ ...
+}: let
+ inherit (inputs) nixinate openwrt-imagebuilder;
+ inherit ((inputs.getchoo.lib inputs).configs) mapHMUsers mapHosts;
+in {
+ flake = {
+ nixosConfigurations = mapHosts ../hosts;
+
+ nixosModules.getchoo = import ../modules;
+ };
+
+ perSystem = {
+ pkgs,
+ system,
+ ...
+ }: {
+ apps = (nixinate.nixinate.${system} self).nixinate;
+
+ legacyPackages.homeConfigurations = mapHMUsers system ../users;
+
+ packages = {
+ turret = pkgs.callPackage ../hosts/_turret {inherit openwrt-imagebuilder;};
+ };
+ };
+}
diff --git a/flake/default.nix b/flake/default.nix
new file mode 100644
index 0000000..a479898
--- /dev/null
+++ b/flake/default.nix
@@ -0,0 +1,14 @@
+_: {
+ imports = [
+ ./configs.nix
+ ./ci.nix
+ ./dev.nix
+ ];
+
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+ ];
+}
diff --git a/flake/dev.nix b/flake/dev.nix
new file mode 100644
index 0000000..700c795
--- /dev/null
+++ b/flake/dev.nix
@@ -0,0 +1,47 @@
+{
+ self,
+ inputs,
+ ...
+}: let
+ inherit (inputs) pre-commit-hooks ragenix;
+in {
+ perSystem = {
+ pkgs,
+ system,
+ ...
+ }: {
+ checks = {
+ pre-commit-check = pre-commit-hooks.lib.${system}.run {
+ src = ./.;
+ hooks = {
+ actionlint.enable = true;
+ alejandra.enable = true;
+ deadnix.enable = true;
+ statix.enable = true;
+ stylua.enable = true;
+ };
+ };
+ };
+
+ devShells = let
+ inherit (pkgs) mkShell;
+ in {
+ default = mkShell {
+ inherit (self.checks.${system}.pre-commit-check) shellHook;
+ packages = with pkgs; [
+ actionlint
+ ragenix.packages.${system}.ragenix
+ alejandra
+ deadnix
+ fzf
+ git-crypt
+ just
+ statix
+ stylua
+ ];
+ };
+ };
+
+ formatter = pkgs.alejandra;
+ };
+}
diff --git a/hosts/default.nix b/hosts/default.nix
index e0f5397..7bc973f 100644
--- a/hosts/default.nix
+++ b/hosts/default.nix
@@ -10,7 +10,7 @@ with inputs; let
nur.nixosModules.nur
self.nixosModules.getchoo
- users.seth.default
+ "${self}/users/seth"
{
age = {
@@ -66,7 +66,6 @@ in {
nixos-hardware.nixosModules.common-gpu-nvidia-nonprime
nixos-hardware.nixosModules.common-pc-ssd
lanzaboote.nixosModules.lanzaboote
- (import "${self}/modules/nixos/virtualisation.nix")
];
};
glados-wsl = {
diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix
index 0c482ac..5767d6b 100644
--- a/modules/nixos/default.nix
+++ b/modules/nixos/default.nix
@@ -14,7 +14,7 @@ in {
./root.nix
./security.nix
./systemd.nix
- #./virtualisation.nix
+ ./virtualisation.nix
];
config = mkIf cfg.enable {
diff --git a/modules/nixos/virtualisation.nix b/modules/nixos/virtualisation.nix
index d3ceb28..5f2fec3 100644
--- a/modules/nixos/virtualisation.nix
+++ b/modules/nixos/virtualisation.nix
@@ -15,7 +15,6 @@ in {
enable = true;
enableNvidia = true;
extraPackages = with pkgs; [podman-compose];
- autoPrune.enable = true;
};
oci-containers.backend = "podman";
};