flake.nix: use clan

This commit is contained in:
makefu 2023-10-01 23:00:36 +02:00
parent 1e2e2bdd35
commit 2528a25c31
No known key found for this signature in database
GPG key ID: 36F7711F3FC0F225
2 changed files with 243 additions and 74 deletions

View file

@ -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,

View file

@ -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";
@ -44,44 +48,21 @@
};
description = "Flake of makefu";
outputs = { self, nixpkgs, lanzaboote, disko, nixos-hardware, nix-ld,
sops-nix, stockholm, home-manager, nix-writers, vscode-server, ...}@inputs: let
outputs = { self, nixpkgs, lanzaboote, disko, nixos-hardware, nix-ld, clan-core,
stockholm, home-manager, nix-writers, vscode-server, ...}@inputs:
let
inherit (nixpkgs) lib;
in {
nixosModules =
builtins.listToAttrs
(map
(name: {name = lib.removeSuffix ".nix" name; value = import (./3modules + "/${name}");})
(lib.filter
(name: !lib.hasPrefix "." name)
(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";
clan = clan-core.lib.buildClan {
directory = self;
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
] ;
inherit (inputs) nixos-hardware self stockholm nixpkgs;
};
};
modules = [
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
sops-nix.nixosModules.sops
home-manager.nixosModules.default
lanzaboote.nixosModules.lanzaboote
@ -107,10 +88,30 @@
self.nixosModules.default
vscode-server.nixosModules.default
#self.nixosModules.krebs
(./1systems + "/${host}/config.nix")
(./machines + "/${host}/config.nix")
];
});
};
in {
inherit (clan) nixosConfigurations clanInternals;
nixosModules =
builtins.listToAttrs
(map
(name: {name = lib.removeSuffix ".nix" name; value = import (./3modules + "/${name}");})
(lib.filter
(name: !lib.hasPrefix "." name)
(lib.attrNames (builtins.readDir ./3modules))));
overlays.default = import ./5pkgs/default.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
];
};
};
}