mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-22 20:00:54 +01:00
move out of flake
This commit is contained in:
parent
6f4cea8ac3
commit
60db0d8369
8 changed files with 292 additions and 1292 deletions
75
default.nix
Normal file
75
default.nix
Normal file
|
@ -0,0 +1,75 @@
|
|||
let
|
||||
inputs = import ./deps;
|
||||
nixpkgs = import inputs.nixpkgs { };
|
||||
lib = nixpkgs.lib.extend (import ./lib inputs);
|
||||
machines_plats = lib.mapAttrsToList (_name: value: value.arch) (lib.filterAttrs (_n: v: builtins.hasAttr "arch" v) lib.luj.machines);
|
||||
mkMachine = import ./lib/mkmachine.nix inputs lib;
|
||||
|
||||
nixpkgs_plats = builtins.listToAttrs (builtins.map
|
||||
(plat: {
|
||||
name = plat;
|
||||
value = import nixpkgs { system = plat; };
|
||||
})
|
||||
machines_plats);
|
||||
in
|
||||
rec {
|
||||
|
||||
nixosModules = builtins.listToAttrs (map
|
||||
(x: {
|
||||
name = x;
|
||||
value = import (./modules + "/${x}");
|
||||
})
|
||||
(builtins.attrNames (builtins.readDir ./modules)));
|
||||
|
||||
nixosConfigurations = builtins.mapAttrs
|
||||
(name: value: (mkMachine {
|
||||
host-config = value;
|
||||
modules = nixosModules;
|
||||
nixpkgs = lib.luj.machines.${name}.nixpkgs_version;
|
||||
system = lib.luj.machines.${name}.arch;
|
||||
home-manager = lib.luj.machines.${name}.hm_version;
|
||||
}))
|
||||
(lib.importConfig ./machines);
|
||||
|
||||
|
||||
colmena =
|
||||
let
|
||||
deployableConfigurations = lib.filterAttrs (_: v: builtins.hasAttr "ipv4" lib.luj.machines.${v.config.networking.hostName}) nixosConfigurations;
|
||||
in
|
||||
{
|
||||
meta = {
|
||||
nixpkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
|
||||
nodeNixpkgs = builtins.mapAttrs (_: v: v.pkgs) deployableConfigurations;
|
||||
nodeSpecialArgs = builtins.mapAttrs (_: v: v._module.specialArgs) deployableConfigurations;
|
||||
specialArgs.lib = lib;
|
||||
};
|
||||
} // builtins.mapAttrs
|
||||
(_: v: {
|
||||
imports = v._module.args.modules;
|
||||
})
|
||||
deployableConfigurations;
|
||||
|
||||
|
||||
packages = builtins.listToAttrs
|
||||
(builtins.map
|
||||
(plat: {
|
||||
name = plat;
|
||||
value =
|
||||
lib.filterAttrs (_name: value: (!lib.hasAttrByPath [ "meta" "platforms" ] value) || builtins.elem plat value.meta.platforms)
|
||||
(builtins.listToAttrs (builtins.map
|
||||
(e: {
|
||||
name = e;
|
||||
value = nixpkgs_plats.${plat}.callPackage (./packages + "/${e}") { };
|
||||
})
|
||||
(builtins.attrNames (builtins.readDir ./packages))));
|
||||
})
|
||||
machines_plats);
|
||||
|
||||
inherit (lib.luj) machines;
|
||||
|
||||
checks = {
|
||||
inherit packages;
|
||||
machines = lib.mapAttrs (_: v: v.config.system.build.toplevel) nixosConfigurations;
|
||||
};
|
||||
}
|
||||
|
47
deps/default.nix
vendored
Normal file
47
deps/default.nix
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Generated by npins. Do not modify; will be overwritten regularly
|
||||
let
|
||||
data = builtins.fromJSON (builtins.readFile ./sources.json);
|
||||
version = data.version;
|
||||
|
||||
mkSource = spec:
|
||||
assert spec ? type; let
|
||||
path =
|
||||
if spec.type == "Git" then mkGitSource spec
|
||||
else if spec.type == "GitRelease" then mkGitSource spec
|
||||
else if spec.type == "PyPi" then mkPyPiSource spec
|
||||
else if spec.type == "Channel" then mkChannelSource spec
|
||||
else builtins.throw "Unknown source type ${spec.type}";
|
||||
in
|
||||
spec // { outPath = path; };
|
||||
|
||||
mkGitSource = { repository, revision, url ? null, hash, ... }:
|
||||
assert repository ? type;
|
||||
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
|
||||
# In the latter case, there we will always be an url to the tarball
|
||||
if url != null then
|
||||
(builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash; # FIXME: check nix version & use SRI hashes
|
||||
})
|
||||
else assert repository.type == "Git"; builtins.fetchGit {
|
||||
url = repository.url;
|
||||
rev = revision;
|
||||
# hash = hash;
|
||||
};
|
||||
|
||||
mkPyPiSource = { url, hash, ... }:
|
||||
builtins.fetchurl {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
mkChannelSource = { url, hash, ... }:
|
||||
builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
in
|
||||
if version == 3 then
|
||||
builtins.mapAttrs (_: mkSource) data.pins
|
||||
else
|
||||
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
149
deps/sources.json
vendored
Normal file
149
deps/sources.json
vendored
Normal file
|
@ -0,0 +1,149 @@
|
|||
{
|
||||
"pins": {
|
||||
"attic": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "zhaofengli",
|
||||
"repo": "attic"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "4dbdbee45728d8ce5788db6461aaaa89d98081f0",
|
||||
"url": "https://github.com/zhaofengli/attic/archive/4dbdbee45728d8ce5788db6461aaaa89d98081f0.tar.gz",
|
||||
"hash": "1iri77pbf0gvas93zra29qy1c3l61n97z84xblqxmmhsxvljzvnh"
|
||||
},
|
||||
"buildbot-nix": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "JulienMalka",
|
||||
"repo": "buildbot-nix"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "88d60799a4cc8bfdd85f65468a1b225af402c66a",
|
||||
"url": "https://github.com/JulienMalka/buildbot-nix/archive/88d60799a4cc8bfdd85f65468a1b225af402c66a.tar.gz",
|
||||
"hash": "1qdccfclg2avk3z72cql3n8lcci0nal9n92s8ravrfv3jbni62dm"
|
||||
},
|
||||
"colmena": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "zhaofengli",
|
||||
"repo": "colmena"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "cd65ef7a25cdc75052fbd04b120aeb066c3881db",
|
||||
"url": "https://github.com/zhaofengli/colmena/archive/cd65ef7a25cdc75052fbd04b120aeb066c3881db.tar.gz",
|
||||
"hash": "0n1j499702iclz4hdb4ywvmn8rl4d1mbdf43dwm7lvpjq5pjjqc1"
|
||||
},
|
||||
"home-manager": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager"
|
||||
},
|
||||
"branch": "release-23.11",
|
||||
"revision": "f33900124c23c4eca5831b9b5eb32ea5894375ce",
|
||||
"url": "https://github.com/nix-community/home-manager/archive/f33900124c23c4eca5831b9b5eb32ea5894375ce.tar.gz",
|
||||
"hash": "0g51f2hz13dk953i501fmc6935difhz60741nypaqwz127hy5ldk"
|
||||
},
|
||||
"home-manager-unstable": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager"
|
||||
},
|
||||
"branch": "master",
|
||||
"revision": "30f2ec39519f4f5a8a96af808c439e730c15aeab",
|
||||
"url": "https://github.com/nix-community/home-manager/archive/30f2ec39519f4f5a8a96af808c439e730c15aeab.tar.gz",
|
||||
"hash": "11jy0k35j1f27agqzvs3yq37chdvw1xvnymgv2ds3fymasg5m5j2"
|
||||
},
|
||||
"homepage": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "JulienMalka",
|
||||
"repo": "homepage"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "29e779d8600b1c1e6235570a3614a54f8ec8126e",
|
||||
"url": "https://github.com/JulienMalka/homepage/archive/29e779d8600b1c1e6235570a3614a54f8ec8126e.tar.gz",
|
||||
"hash": "0prma1rg6glf3xy1dkd6gbzb26z1sxkgzd8wr623pbqvf44hgv32"
|
||||
},
|
||||
"lanzaboote": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "nix-community",
|
||||
"repo": "lanzaboote"
|
||||
},
|
||||
"branch": "master",
|
||||
"revision": "df7ac26bd24fac8baa94d60a02c3e0f0d4d16368",
|
||||
"url": "https://github.com/nix-community/lanzaboote/archive/df7ac26bd24fac8baa94d60a02c3e0f0d4d16368.tar.gz",
|
||||
"hash": "0s1bvc2px5z6qab1i78kjdgzh6w3y1by9sc87q7bcyirqv6xh3gw"
|
||||
},
|
||||
"nix-index-database": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "mic92",
|
||||
"repo": "nix-index-database"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "2844b5f3ad3b478468151bd101370b9d8ef8a3a7",
|
||||
"url": "https://github.com/mic92/nix-index-database/archive/2844b5f3ad3b478468151bd101370b9d8ef8a3a7.tar.gz",
|
||||
"hash": "1kg8h513n2wk83bqh06pv73cvipfj171x5qqqzgv8kr5zimavx14"
|
||||
},
|
||||
"nixos-mailserver": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitLab",
|
||||
"repo_path": "simple-nixos-mailserver/nixos-mailserver",
|
||||
"server": "https://gitlab.com/"
|
||||
},
|
||||
"branch": "nixos-23.11",
|
||||
"revision": "e47f3719f1db3e0961a4358d4cb234a0acaa7baf",
|
||||
"url": "https://gitlab.com/api/v4/projects/simple-nixos-mailserver%2Fnixos-mailserver/repository/archive.tar.gz?sha=e47f3719f1db3e0961a4358d4cb234a0acaa7baf",
|
||||
"hash": "122vm4n3gkvlkqmlskiq749bhwfd0r71v6vcmg1bbyg4998brvx8"
|
||||
},
|
||||
"nixpkgs": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs"
|
||||
},
|
||||
"branch": "nixos-23.11",
|
||||
"revision": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
|
||||
"url": "https://github.com/nixos/nixpkgs/archive/219951b495fc2eac67b1456824cc1ec1fd2ee659.tar.gz",
|
||||
"hash": "065jy7qivlbdqmbvd7r9h97b23f21axmc4r7sqmq2h0j82rmymxv"
|
||||
},
|
||||
"sops-nix": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "mic92",
|
||||
"repo": "sops-nix"
|
||||
},
|
||||
"branch": "master",
|
||||
"revision": "99b1e37f9fc0960d064a7862eb7adfb92e64fa10",
|
||||
"url": "https://github.com/mic92/sops-nix/archive/99b1e37f9fc0960d064a7862eb7adfb92e64fa10.tar.gz",
|
||||
"hash": "0s3lrd3fqy6djd9j6bjafqafb16x5a11f6xif6w209fhz40a05qz"
|
||||
},
|
||||
"unstable": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "GitHub",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs"
|
||||
},
|
||||
"branch": "nixos-unstable",
|
||||
"revision": "d8fe5e6c92d0d190646fb9f1056741a229980089",
|
||||
"url": "https://github.com/nixos/nixpkgs/archive/d8fe5e6c92d0d190646fb9f1056741a229980089.tar.gz",
|
||||
"hash": "0jd6x1qaggxklah856zx86dxwy4j17swv4df52njcn3ln410bic8"
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
}
|
1143
flake.lock
generated
1143
flake.lock
generated
File diff suppressed because it is too large
Load diff
134
flake.nix
134
flake.nix
|
@ -1,134 +0,0 @@
|
|||
{
|
||||
description = "A flake for my personnal configurations";
|
||||
|
||||
inputs = {
|
||||
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-23.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
home-manager-unstable = {
|
||||
url = "github:nix-community/home-manager/master";
|
||||
};
|
||||
|
||||
homepage = {
|
||||
url = "github:JulienMalka/homepage";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
colmena.url = "github:zhaofengli/colmena";
|
||||
|
||||
sops-nix = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "unstable";
|
||||
inputs.nixpkgs-stable.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
simple-nixos-mailserver = {
|
||||
url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-22.11";
|
||||
inputs.nixpkgs.follows = "unstable";
|
||||
inputs.nixpkgs-22_11.follows = "nixpkgs";
|
||||
inputs.utils.follows = "flake-utils";
|
||||
};
|
||||
|
||||
attic = {
|
||||
url = "github:zhaofengli/attic";
|
||||
inputs.nixpkgs.follows = "unstable";
|
||||
inputs.nixpkgs-stable.follows = "nixpkgs";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
|
||||
nix-index-database = {
|
||||
url = "github:Mic92/nix-index-database";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
lanzaboote = {
|
||||
url = "github:nix-community/lanzaboote/master";
|
||||
};
|
||||
|
||||
buildbot-nix.url = "github:JulienMalka/buildbot-nix";
|
||||
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs:
|
||||
let
|
||||
lib = nixpkgs.lib.extend (import ./lib inputs);
|
||||
machines_plats = lib.mapAttrsToList (_name: value: value.arch) (lib.filterAttrs (_n: v: builtins.hasAttr "arch" v) lib.luj.machines);
|
||||
mkMachine = import ./lib/mkmachine.nix inputs lib;
|
||||
|
||||
nixpkgs_plats = builtins.listToAttrs (builtins.map
|
||||
(plat: {
|
||||
name = plat;
|
||||
value = import nixpkgs { system = plat; };
|
||||
})
|
||||
machines_plats);
|
||||
in
|
||||
rec {
|
||||
|
||||
nixosModules = builtins.listToAttrs (map
|
||||
(x: {
|
||||
name = x;
|
||||
value = import (./modules + "/${x}");
|
||||
})
|
||||
(builtins.attrNames (builtins.readDir ./modules)));
|
||||
|
||||
nixosConfigurations = builtins.mapAttrs
|
||||
(name: value: (mkMachine {
|
||||
host-config = value;
|
||||
modules = self.nixosModules;
|
||||
nixpkgs = lib.luj.machines.${name}.nixpkgs_version;
|
||||
system = lib.luj.machines.${name}.arch;
|
||||
home-manager = lib.luj.machines.${name}.hm_version;
|
||||
}))
|
||||
(lib.importConfig ./machines);
|
||||
|
||||
|
||||
colmena =
|
||||
let
|
||||
deployableConfigurations = lib.filterAttrs (_: v: builtins.hasAttr "ipv4" lib.luj.machines.${v.config.networking.hostName}) nixosConfigurations;
|
||||
in
|
||||
{
|
||||
meta = {
|
||||
nixpkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
|
||||
nodeNixpkgs = builtins.mapAttrs (_: v: v.pkgs) deployableConfigurations;
|
||||
nodeSpecialArgs = builtins.mapAttrs (_: v: v._module.specialArgs) deployableConfigurations;
|
||||
specialArgs.lib = lib;
|
||||
};
|
||||
} // builtins.mapAttrs
|
||||
(_: v: {
|
||||
imports = v._module.args.modules;
|
||||
})
|
||||
deployableConfigurations;
|
||||
|
||||
|
||||
packages = builtins.listToAttrs
|
||||
(builtins.map
|
||||
(plat: {
|
||||
name = plat;
|
||||
value =
|
||||
lib.filterAttrs (_name: value: (!lib.hasAttrByPath [ "meta" "platforms" ] value) || builtins.elem plat value.meta.platforms)
|
||||
(builtins.listToAttrs (builtins.map
|
||||
(e: {
|
||||
name = e;
|
||||
value = nixpkgs_plats.${plat}.callPackage (./packages + "/${e}") { };
|
||||
})
|
||||
(builtins.attrNames (builtins.readDir ./packages))));
|
||||
})
|
||||
machines_plats);
|
||||
|
||||
inherit (lib.luj) machines;
|
||||
|
||||
checks = {
|
||||
inherit packages;
|
||||
machines = lib.mapAttrs (_: v: v.config.system.build.toplevel) self.nixosConfigurations;
|
||||
};
|
||||
};
|
||||
}
|
1
hive.nix
Normal file
1
hive.nix
Normal file
|
@ -0,0 +1 @@
|
|||
let outputs = import ./.; in outputs.colmena
|
|
@ -3,14 +3,16 @@ inputs: lib:
|
|||
let
|
||||
overlay-unstable = arch: _final: _prev:
|
||||
{
|
||||
unstable = inputs.unstable.legacyPackages."${arch}";
|
||||
unstable = import inputs.unstable { };
|
||||
};
|
||||
in
|
||||
|
||||
{ host-config, modules, nixpkgs ? inputs.nixpkgs, system ? "x86_64-linux", home-manager ? inputs.home-manager }:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
let pkgs = import nixpkgs { };
|
||||
in
|
||||
import "${nixpkgs}/nixos/lib/eval-config.nix" {
|
||||
inherit system;
|
||||
lib = nixpkgs.lib.extend (import ./default.nix inputs);
|
||||
lib = pkgs.lib.extend (import ./default.nix inputs);
|
||||
specialArgs =
|
||||
{
|
||||
inherit inputs;
|
||||
|
@ -18,14 +20,13 @@ nixpkgs.lib.nixosSystem {
|
|||
modules = builtins.attrValues modules ++ [
|
||||
../machines/base.nix
|
||||
host-config
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
home-manager.nixosModules.home-manager
|
||||
inputs.simple-nixos-mailserver.nixosModule
|
||||
inputs.attic.nixosModules.atticd
|
||||
inputs.lanzaboote.nixosModules.lanzaboote
|
||||
inputs.nix-index-database.nixosModules.nix-index
|
||||
inputs.buildbot-nix.nixosModules.buildbot-master
|
||||
inputs.buildbot-nix.nixosModules.buildbot-worker
|
||||
(import "${inputs.sops-nix}/modules/sops")
|
||||
(import "${inputs.home-manager}/nixos")
|
||||
(import "${inputs.nixos-mailserver}")
|
||||
(import "${inputs.attic}/nixos/atticd.nix")
|
||||
(import "${inputs.lanzaboote}/nix/modules/lanzaboote.nix")
|
||||
(import "${inputs.buildbot-nix}/nix/master.nix")
|
||||
(import "${inputs.buildbot-nix}/nix/worker.nix")
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
nixpkgs.overlays = [
|
||||
|
@ -36,7 +37,8 @@ nixpkgs.lib.nixosSystem {
|
|||
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
|
||||
});
|
||||
# Packages comming from other repositories
|
||||
attic = inputs.attic.packages.${system}.default;
|
||||
|
||||
attic = import inputs.attic;
|
||||
inherit (inputs.colmena.packages.${system}) colmena;
|
||||
inherit (prev.unstable) bcachefs-tools;
|
||||
# My own packages
|
||||
|
@ -46,6 +48,11 @@ nixpkgs.lib.nixosSystem {
|
|||
];
|
||||
}
|
||||
];
|
||||
extraModules = [ inputs.colmena.nixosModules.deploymentOptions ];
|
||||
extraModules =
|
||||
let
|
||||
colmenaModules = import
|
||||
"${inputs.colmena}/src/nix/hive/options.nix";
|
||||
in
|
||||
[ colmenaModules.deploymentOptions ];
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
|
||||
environment.variables.EDITOR = "nvim";
|
||||
|
||||
programs.command-not-found.enable = false;
|
||||
programs.nix-index-database.comma.enable = true;
|
||||
networking.networkmanager.dns = "systemd-resolved";
|
||||
services.resolved.enable = true;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue