diff --git a/flake.lock b/flake.lock index 392395b..932115d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,31 @@ { "nodes": { + "clan-core": { + "inputs": { + "disko": "disko", + "flake-parts": "flake-parts", + "floco": "floco", + "nixos-generators": "nixos-generators", + "nixpkgs": [ + "nixpkgs-unstable" + ], + "sops-nix": "sops-nix", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1696157588, + "narHash": "sha256-ZJ4+dL5c8OFia5St3c5+/PxvUkzXCw0akOWYpytjpwk=", + "ref": "refs/heads/main", + "rev": "29efda96087dac2a1512d555c131ecfd7da816db", + "revCount": 919, + "type": "git", + "url": "https://git.clan.lol/clan/clan-core" + }, + "original": { + "type": "git", + "url": "https://git.clan.lol/clan/clan-core" + } + }, "crane": { "inputs": { "flake-compat": [ @@ -34,6 +60,28 @@ } }, "disko": { + "inputs": { + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1695379860, + "narHash": "sha256-ADsWLw33T/6APAoEfwPVkhuUHbH/BW/Jz5cgTgijsIs=", + "owner": "nix-community", + "repo": "disko", + "rev": "26cf7576b85fd0b4070d8bd84475021e01d63814", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "party", + "repo": "disko", + "type": "github" + } + }, + "disko_2": { "inputs": { "nixpkgs": [ "nixpkgs" @@ -70,6 +118,27 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1693611461, + "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "nixpkgs" @@ -89,7 +158,7 @@ "type": "github" } }, - "flake-parts_2": { + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "lanzaboote", @@ -233,6 +302,27 @@ "type": "github" } }, + "floco": { + "inputs": { + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1694873346, + "narHash": "sha256-Uvh03bg0a6ZnNWiX1Gb8g+m343wSJ/wb8ryUASt0loc=", + "owner": "aakropotkin", + "repo": "floco", + "rev": "d16bd444ab9d29a6640f52ee4e43a66528e07515", + "type": "github" + }, + "original": { + "owner": "aakropotkin", + "repo": "floco", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -323,7 +413,7 @@ "inputs": { "crane": "crane", "flake-compat": "flake-compat", - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "flake-utils": "flake-utils_5", "nixpkgs": [ "nixpkgs" @@ -388,6 +478,43 @@ "url": "https://cgit.krebsco.de/nix-writers" } }, + "nixlib": { + "locked": { + "lastModified": 1693701915, + "narHash": "sha256-waHPLdDYUOHSEtMKKabcKIMhlUOHPOOPQ9UyFeEoovs=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "f5af57d3ef9947a70ac86e42695231ac1ad00c25", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1693791338, + "narHash": "sha256-wHmtB5H8AJTUaeGHw+0hsQ6nU4VyvVrP2P4NeCocRzY=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "8ee78470029e641cddbd8721496da1316b47d3b4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1686217350, @@ -405,11 +532,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1694937365, - "narHash": "sha256-iHZSGrb9gVpZRR4B2ishUN/1LRKWtSHZNO37C8z1SmA=", + "lastModified": 1695825837, + "narHash": "sha256-4Ne11kNRnQsmSJCRSSNkFRSnHC4Y5gPDBIQGjjPfJiU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5d017a8822e0907fb96f7700a319f9fe2434de02", + "rev": "5cfafa12d57374f48bcc36fda3274ada276cf69e", "type": "github" }, "original": { @@ -435,6 +562,22 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1696019113, + "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "poetry2nix": { "inputs": { "flake-utils": "flake-utils_2", @@ -512,8 +655,9 @@ }, "root": { "inputs": { - "disko": "disko", - "flake-parts": "flake-parts", + "clan-core": "clan-core", + "disko": "disko_2", + "flake-parts": "flake-parts_2", "ha-ara-menu": "ha-ara-menu", "home-manager": "home-manager", "inventory4ce": "inventory4ce", @@ -522,7 +666,7 @@ "nix-writers": "nix-writers", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", - "sops-nix": "sops-nix", + "nixpkgs-unstable": "nixpkgs-unstable", "stockholm": "stockholm", "vscode-server": "vscode-server" } @@ -555,16 +699,19 @@ "sops-nix": { "inputs": { "nixpkgs": [ - "nixpkgs" + "clan-core", + "sops-nix" ], - "nixpkgs-stable": [] + "nixpkgs-stable": [ + "clan-core" + ] }, "locked": { - "lastModified": 1685848844, - "narHash": "sha256-Iury+/SVbAwLES76QJSiKFiQDzmf/8Hsq8j54WF2qyw=", + "lastModified": 1695284550, + "narHash": "sha256-z9fz/wz9qo9XePEvdduf+sBNeoI9QG8NJKl5ssA8Xl4=", "owner": "Mic92", "repo": "sops-nix", - "rev": "a522e12ee35e50fa7d902a164a9796e420e6e75b", + "rev": "2f375ed8702b0d8ee2430885059d5e7975e38f78", "type": "github" }, "original": { @@ -686,6 +833,27 @@ "type": "github" } }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "clan-core", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1695290086, + "narHash": "sha256-ol6licpIAzc9oMsEai/9YZhgSMcrnlnD/3ulMLGNKL0=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "e951529be2e7c669487de78f5aef8597bbae5fca", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1667395993, diff --git a/flake.nix b/flake.nix index 5aaf119..7b24b49 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,14 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; + + clan-core = { + url = "git+https://git.clan.lol/clan/clan-core"; + # Don't do this if your machines are on nixpkgs stable. + inputs.nixpkgs.follows = "nixpkgs-unstable"; + }; - sops-nix.url = "github:Mic92/sops-nix"; - sops-nix.inputs.nixpkgs.follows = "nixpkgs"; - sops-nix.inputs.nixpkgs-stable.follows = ""; nixos-hardware.url = "github:NixOS/nixos-hardware"; @@ -20,7 +24,7 @@ nix-ld.url = "github:Mic92/nix-ld"; nix-ld.inputs.nixpkgs.follows = "nixpkgs"; - stockholm.url = "git+https://cgit.euer.krebsco.de/stockholm"; + stockholm.url = "git+https://cgit.euer.krebsco.de/stockholm"; #stockholm.url = "path:///home/makefu/stockholm-flakes"; stockholm.inputs.nixpkgs.follows = "nixpkgs"; stockholm.inputs.nix-writers.follows = "nix-writers"; @@ -44,10 +48,53 @@ }; description = "Flake of makefu"; - outputs = { self, nixpkgs, lanzaboote, disko, nixos-hardware, nix-ld, - sops-nix, stockholm, home-manager, nix-writers, vscode-server, ...}@inputs: let - inherit (nixpkgs) lib; + outputs = { self, nixpkgs, lanzaboote, disko, nixos-hardware, nix-ld, clan-core, + stockholm, home-manager, nix-writers, vscode-server, ...}@inputs: + let + inherit (nixpkgs) lib; + clan = clan-core.lib.buildClan { + directory = self; + specialArgs = { + inherit (inputs) nixos-hardware self stockholm nixpkgs; + }; + machines = lib.genAttrs [ "filepimp" "mrdavid" "x" "cake" "tsp" "wbob" "omo" "gum" "savarcast" ] (host: rec { + # TODO inject the system somewhere else + nixpkgs.hostPlatform = if host == "cake" then "aarch64-linux" else "x86_64-linux"; + imports = [ + disko.nixosModules.disko + nix-ld.nixosModules.nix-ld + home-manager.nixosModules.default + lanzaboote.nixosModules.lanzaboote + + stockholm.nixosModules.brockman + + stockholm.nixosModules.exim-retiolum + stockholm.nixosModules.exim + + stockholm.nixosModules.krebs + stockholm.nixosModules.hosts + stockholm.nixosModules.users + stockholm.nixosModules.build + stockholm.nixosModules.dns + stockholm.nixosModules.kartei + stockholm.nixosModules.sitemap + stockholm.nixosModules.fetchWallpaper + stockholm.nixosModules.git + stockholm.nixosModules.tinc + stockholm.nixosModules.systemd + stockholm.nixosModules.setuid + stockholm.nixosModules.urlwatch + + self.nixosModules.default + vscode-server.nixosModules.default + #self.nixosModules.krebs + (./machines + "/${host}/config.nix") + ]; + + }); + }; in { + inherit (clan) nixosConfigurations clanInternals; nixosModules = builtins.listToAttrs (map @@ -57,60 +104,14 @@ (lib.attrNames (builtins.readDir ./3modules)))); overlays.default = import ./5pkgs/default.nix; - nixosConfigurations = lib.genAttrs [ "filepimp" "mrdavid" "x" "cake" "tsp" "wbob" "omo" "gum" "savarcast" ] (host: nixpkgs.lib.nixosSystem rec { - # TODO inject the system somewhere else - system = if host == "cake" then "aarch64-linux" else "x86_64-linux"; - specialArgs = { - inherit (inputs) nixos-hardware self stockholm ha-ara-menu nixpkgs; - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - overlays = [ - (self: super: { - inherit (self.writers) writeDash writeDashBin; - stockholm.lib = stockholm.lib; - ha-ara-menu = inputs.ha-ara-menu.packages.${system}.default; - inventory4ce = inputs.inventory4ce.packages.${system}.default; - }) - self.overlays.default - stockholm.overlays.default - inputs.nix-writers.overlays.default - ] ; - }; - }; - modules = [ - disko.nixosModules.disko - nix-ld.nixosModules.nix-ld - sops-nix.nixosModules.sops - home-manager.nixosModules.default - lanzaboote.nixosModules.lanzaboote - - stockholm.nixosModules.brockman - - stockholm.nixosModules.exim-retiolum - stockholm.nixosModules.exim - - stockholm.nixosModules.krebs - stockholm.nixosModules.hosts - stockholm.nixosModules.users - stockholm.nixosModules.build - stockholm.nixosModules.dns - stockholm.nixosModules.kartei - stockholm.nixosModules.sitemap - stockholm.nixosModules.fetchWallpaper - stockholm.nixosModules.git - stockholm.nixosModules.tinc - stockholm.nixosModules.systemd - stockholm.nixosModules.setuid - stockholm.nixosModules.urlwatch - - self.nixosModules.default - vscode-server.nixosModules.default - #self.nixosModules.krebs - (./1systems + "/${host}/config.nix") - ]; - - }); + devShells.x86_64-linux.default = let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + in pkgs.mkShell { + packages = [ + clan-core.packages.x86_64-linux.clan-cli + pkgs.age + ]; + }; }; }