Rename nixpkgs input to nixos
This commit is contained in:
parent
9eef50b0f0
commit
a48b72c4a3
65
flake.nix
65
flake.nix
|
@ -2,7 +2,7 @@
|
||||||
description = "C3D2 NixOS configurations";
|
description = "C3D2 NixOS configurations";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
|
nixos.url = "github:nixos/nixpkgs/nixos-22.05";
|
||||||
nixpkgs-mobilizon.url = "github:minijackson/nixpkgs/init-mobilizon";
|
nixpkgs-mobilizon.url = "github:minijackson/nixpkgs/init-mobilizon";
|
||||||
nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
# contains portunus WIP branch on current nixos-unstable
|
# contains portunus WIP branch on current nixos-unstable
|
||||||
|
@ -10,13 +10,13 @@
|
||||||
nixos-hardware.url = "github:nixos/nixos-hardware";
|
nixos-hardware.url = "github:nixos/nixos-hardware";
|
||||||
fenix = {
|
fenix = {
|
||||||
url = "github:nix-community/fenix";
|
url = "github:nix-community/fenix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixos";
|
||||||
};
|
};
|
||||||
heliwatch = {
|
heliwatch = {
|
||||||
url = "git+https://gitea.c3d2.de/astro/heliwatch.git";
|
url = "git+https://gitea.c3d2.de/astro/heliwatch.git";
|
||||||
inputs = {
|
inputs = {
|
||||||
fenix.follows = "fenix";
|
fenix.follows = "fenix";
|
||||||
nixpkgs.follows = "nixpkgs";
|
nixpkgs.follows = "nixos";
|
||||||
naersk.follows = "naersk";
|
naersk.follows = "naersk";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -24,11 +24,11 @@
|
||||||
hydra-ca.url = "github:mlabs-haskell/hydra/aciceri/ca-derivations";
|
hydra-ca.url = "github:mlabs-haskell/hydra/aciceri/ca-derivations";
|
||||||
microvm = {
|
microvm = {
|
||||||
url = "github:astro/microvm.nix";
|
url = "github:astro/microvm.nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixos";
|
||||||
};
|
};
|
||||||
naersk = {
|
naersk = {
|
||||||
url = "github:nix-community/naersk";
|
url = "github:nix-community/naersk";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixos";
|
||||||
};
|
};
|
||||||
oparl-scraper = {
|
oparl-scraper = {
|
||||||
url = "github:offenesdresden/ratsinfo-scraper/oparl";
|
url = "github:offenesdresden/ratsinfo-scraper/oparl";
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
openwrt-imagebuilder = {
|
openwrt-imagebuilder = {
|
||||||
url = "github:astro/nix-openwrt-imagebuilder";
|
url = "github:astro/nix-openwrt-imagebuilder";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.follows = "nixpkgs";
|
nixpkgs.follows = "nixos";
|
||||||
openwrt.follows = "openwrt";
|
openwrt.follows = "openwrt";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -52,15 +52,15 @@
|
||||||
secrets = {
|
secrets = {
|
||||||
url = "git+ssh://gitea@gitea.c3d2.de/c3d2-admins/secrets.git";
|
url = "git+ssh://gitea@gitea.c3d2.de/c3d2-admins/secrets.git";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.follows = "nixpkgs";
|
nixpkgs.follows = "nixos";
|
||||||
sops-nix.follows = "sops-nix";
|
sops-nix.follows = "sops-nix";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
sops-nix = {
|
sops-nix = {
|
||||||
url = "github:Mic92/sops-nix";
|
url = "github:Mic92/sops-nix";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.follows = "nixpkgs";
|
nixpkgs.follows = "nixos";
|
||||||
nixpkgs-22_05.follows = "nixpkgs";
|
nixpkgs-22_05.follows = "nixos";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
spacemsg = {
|
spacemsg = {
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
fenix.follows = "fenix";
|
fenix.follows = "fenix";
|
||||||
naersk.follows = "naersk";
|
naersk.follows = "naersk";
|
||||||
nixpkgs.follows = "nixpkgs";
|
nixpkgs.follows = "nixos";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
tigger = {
|
tigger = {
|
||||||
|
@ -81,26 +81,26 @@
|
||||||
};
|
};
|
||||||
yammat = {
|
yammat = {
|
||||||
url = "git+https://gitea.c3d2.de/C3D2/yammat.git?ref=nix";
|
url = "git+https://gitea.c3d2.de/C3D2/yammat.git?ref=nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixos";
|
||||||
};
|
};
|
||||||
zentralwerk = {
|
zentralwerk = {
|
||||||
url = "git+https://gitea.c3d2.de/zentralwerk/network.git";
|
url = "git+https://gitea.c3d2.de/zentralwerk/network.git";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.follows = "nixpkgs";
|
nixpkgs.follows = "nixos";
|
||||||
nixpkgs-master.follows = "nixpkgs";
|
nixpkgs-master.follows = "nixos";
|
||||||
openwrt.follows = "openwrt";
|
openwrt.follows = "openwrt";
|
||||||
openwrt-imagebuilder.follows = "openwrt-imagebuilder";
|
openwrt-imagebuilder.follows = "openwrt-imagebuilder";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
riscv64 = {
|
riscv64 = {
|
||||||
url = "github:zhaofengli/nixos-riscv64";
|
url = "github:zhaofengli/nixos-riscv64";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixos";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ self, nixos-unstable, nixpkgs, secrets, nixos-hardware, zentralwerk, yammat, scrapers, spacemsg, tigger, ticker, heliwatch, sops-nix, naersk, fenix, microvm, riscv64, oparl-scraper, ... }:
|
outputs = inputs@{ self, nixos-unstable, nixos, secrets, nixos-hardware, zentralwerk, yammat, scrapers, spacemsg, tigger, ticker, heliwatch, sops-nix, naersk, fenix, microvm, riscv64, oparl-scraper, ... }:
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixos) lib;
|
||||||
forAllSystems = lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
|
forAllSystems = lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
|
||||||
|
|
||||||
# all the input flakes for `nix copy` to the build machine,
|
# all the input flakes for `nix copy` to the build machine,
|
||||||
|
@ -149,7 +149,7 @@
|
||||||
legacyPackages = lib.attrsets.mapAttrs
|
legacyPackages = lib.attrsets.mapAttrs
|
||||||
(system: pkgs: pkgs.appendOverlays
|
(system: pkgs: pkgs.appendOverlays
|
||||||
[ fenix.overlay naersk.overlay self.overlay ])
|
[ fenix.overlay naersk.overlay self.overlay ])
|
||||||
nixpkgs.legacyPackages;
|
nixos.legacyPackages;
|
||||||
|
|
||||||
packages = lib.attrsets.mapAttrs (system: pkgs:
|
packages = lib.attrsets.mapAttrs (system: pkgs:
|
||||||
let overlayPkgs = builtins.intersectAttrs (self.overlay {} {}) pkgs;
|
let overlayPkgs = builtins.intersectAttrs (self.overlay {} {}) pkgs;
|
||||||
|
@ -167,7 +167,7 @@
|
||||||
${pkgs.lib.concatMapStringsSep "\n" (name:
|
${pkgs.lib.concatMapStringsSep "\n" (name:
|
||||||
let
|
let
|
||||||
addr = getHostAddr name;
|
addr = getHostAddr name;
|
||||||
in nixpkgs.lib.optionalString (addr != null) ''
|
in nixos.lib.optionalString (addr != null) ''
|
||||||
echo -n -e "${name}: $RED"
|
echo -n -e "${name}: $RED"
|
||||||
RUNNING=$(ssh -o PreferredAuthentications=publickey -o StrictHostKeyChecking=accept-new root@"${addr}" "readlink /run/current-system")
|
RUNNING=$(ssh -o PreferredAuthentications=publickey -o StrictHostKeyChecking=accept-new root@"${addr}" "readlink /run/current-system")
|
||||||
if [ $? = 0 ] && [ -n "$RUNNING" ]; then
|
if [ $? = 0 ] && [ -n "$RUNNING" ]; then
|
||||||
|
@ -225,7 +225,7 @@
|
||||||
#!${pkgs.runtimeShell}
|
#!${pkgs.runtimeShell}
|
||||||
exec ${pkgs.wol}/bin/wol ${hostRegistry.hosts."${host}".ether}
|
exec ${pkgs.wol}/bin/wol ${hostRegistry.hosts."${host}".ether}
|
||||||
'';
|
'';
|
||||||
}) {} (builtins.attrNames (nixpkgs.lib.filterAttrs (_: { wol ? false, ... }: wol) hostRegistry.hosts)) //
|
}) {} (builtins.attrNames (nixos.lib.filterAttrs (_: { wol ? false, ... }: wol) hostRegistry.hosts)) //
|
||||||
|
|
||||||
builtins.foldl' (result: name:
|
builtins.foldl' (result: name:
|
||||||
let
|
let
|
||||||
|
@ -369,7 +369,7 @@
|
||||||
inherit (self.nixosConfigurations.${host}) config;
|
inherit (self.nixosConfigurations.${host}) config;
|
||||||
in
|
in
|
||||||
result //
|
result //
|
||||||
nixpkgs.lib.optionalAttrs (config.system.build ? vm) {
|
nixos.lib.optionalAttrs (config.system.build ? vm) {
|
||||||
# boot any machine in a microvm
|
# boot any machine in a microvm
|
||||||
"${host}-vm" = (self.nixosConfigurations.${host}
|
"${host}-vm" = (self.nixosConfigurations.${host}
|
||||||
.extendModules {
|
.extendModules {
|
||||||
|
@ -377,9 +377,9 @@
|
||||||
microvm.nixosModules.microvm
|
microvm.nixosModules.microvm
|
||||||
{
|
{
|
||||||
microvm = {
|
microvm = {
|
||||||
mem = nixpkgs.lib.mkForce 2048;
|
mem = nixos.lib.mkForce 2048;
|
||||||
hypervisor = nixpkgs.lib.mkForce "qemu";
|
hypervisor = nixos.lib.mkForce "qemu";
|
||||||
socket = nixpkgs.lib.mkForce null;
|
socket = nixos.lib.mkForce null;
|
||||||
shares = [ {
|
shares = [ {
|
||||||
tag = "ro-store";
|
tag = "ro-store";
|
||||||
source = "/nix/store";
|
source = "/nix/store";
|
||||||
|
@ -398,7 +398,7 @@
|
||||||
})
|
})
|
||||||
.config.microvm.declaredRunner;
|
.config.microvm.declaredRunner;
|
||||||
} //
|
} //
|
||||||
nixpkgs.lib.optionalAttrs (config.system.build ? tftproot) {
|
nixos.lib.optionalAttrs (config.system.build ? tftproot) {
|
||||||
"${host}-tftproot" = config.system.build.tftproot;
|
"${host}-tftproot" = config.system.build.tftproot;
|
||||||
}
|
}
|
||||||
) {} (builtins.attrNames self.nixosConfigurations)
|
) {} (builtins.attrNames self.nixosConfigurations)
|
||||||
|
@ -407,7 +407,7 @@
|
||||||
nixosConfigurations = let
|
nixosConfigurations = let
|
||||||
nixosSystem' =
|
nixosSystem' =
|
||||||
# Our custom NixOS builder
|
# Our custom NixOS builder
|
||||||
{ nixpkgs ? inputs.nixpkgs, modules, extraArgs ? {}, specialArgs ? { }, system ? "x86_64-linux" }:
|
{ nixpkgs ? inputs.nixos, modules, extraArgs ? {}, specialArgs ? { }, system ? "x86_64-linux" }:
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
inherit specialArgs system;
|
inherit specialArgs system;
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@
|
||||||
|
|
||||||
rpi-netboot = nixosSystem' {
|
rpi-netboot = nixosSystem' {
|
||||||
modules = [
|
modules = [
|
||||||
{ _module.args = { inherit nixpkgs; }; }
|
{ _module.args = { inherit nixos; }; }
|
||||||
nixos-hardware.nixosModules.raspberry-pi-4
|
nixos-hardware.nixosModules.raspberry-pi-4
|
||||||
self.nixosModules.rpi-netboot
|
self.nixosModules.rpi-netboot
|
||||||
./hosts/rpi-netboot
|
./hosts/rpi-netboot
|
||||||
|
@ -668,7 +668,7 @@
|
||||||
|
|
||||||
c3d2-web = nixosSystem' {
|
c3d2-web = nixosSystem' {
|
||||||
modules = [
|
modules = [
|
||||||
{ _module.args = { inherit nixpkgs; }; }
|
{ _module.args = { inherit nixos; }; }
|
||||||
self.nixosModules.microvm
|
self.nixosModules.microvm
|
||||||
./hosts/containers/c3d2-web
|
./hosts/containers/c3d2-web
|
||||||
{ nixpkgs.overlays = [ secrets.overlays.c3d2-web ]; }
|
{ nixpkgs.overlays = [ secrets.overlays.c3d2-web ]; }
|
||||||
|
@ -676,13 +676,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
sdrweb = nixosSystem' {
|
sdrweb = nixosSystem' {
|
||||||
nixpkgs = nixos-unstable;
|
|
||||||
modules = [
|
modules = [
|
||||||
self.nixosModules.microvm
|
self.nixosModules.microvm
|
||||||
{ nixpkgs.overlays = [ secrets.overlays.mucbot ]; }
|
{ nixpkgs.overlays = [ secrets.overlays.mucbot ]; }
|
||||||
heliwatch.nixosModules.heliwatch
|
heliwatch.nixosModules.heliwatch
|
||||||
./hosts/containers/sdrweb
|
./hosts/containers/sdrweb
|
||||||
];
|
];
|
||||||
|
nixpkgs = nixos-unstable;
|
||||||
};
|
};
|
||||||
|
|
||||||
bind = nixosSystem' {
|
bind = nixosSystem' {
|
||||||
|
@ -753,7 +753,7 @@
|
||||||
self.nixosModules.microvm
|
self.nixosModules.microvm
|
||||||
./hosts/containers/nfsroot
|
./hosts/containers/nfsroot
|
||||||
{
|
{
|
||||||
_module.args.tftproots = nixpkgs.lib.filterAttrs (name: _:
|
_module.args.tftproots = nixos.lib.filterAttrs (name: _:
|
||||||
builtins.match ".+-tftproot" name != null
|
builtins.match ".+-tftproot" name != null
|
||||||
) self.packages.x86_64-linux;
|
) self.packages.x86_64-linux;
|
||||||
} ];
|
} ];
|
||||||
|
@ -785,13 +785,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
gnunet = nixosSystem' {
|
gnunet = nixosSystem' {
|
||||||
nixpkgs = nixos-unstable;
|
|
||||||
modules = [
|
modules = [
|
||||||
self.nixosModules.microvm
|
self.nixosModules.microvm
|
||||||
./hosts/containers/gnunet
|
./hosts/containers/gnunet
|
||||||
];
|
];
|
||||||
|
nixpkgs = nixos-unstable;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosModule = self.nixosModules.c3d2;
|
nixosModule = self.nixosModules.c3d2;
|
||||||
|
@ -822,14 +821,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
hydraJobs =
|
hydraJobs =
|
||||||
builtins.mapAttrs (_: nixpkgs.lib.hydraJob) (
|
builtins.mapAttrs (_: nixos.lib.hydraJob) (
|
||||||
builtins.mapAttrs (_: nixosSystem:
|
builtins.mapAttrs (_: nixosSystem:
|
||||||
if nixosSystem.config ? microvm.declaredRunner
|
if nixosSystem.config ? microvm.declaredRunner
|
||||||
then nixosSystem.config.microvm.declaredRunner
|
then nixosSystem.config.microvm.declaredRunner
|
||||||
else nixosSystem.config.system.build.toplevel
|
else nixosSystem.config.system.build.toplevel
|
||||||
) self.nixosConfigurations
|
) self.nixosConfigurations
|
||||||
//
|
//
|
||||||
nixpkgs.lib.filterAttrs (name: _:
|
nixos.lib.filterAttrs (name: _:
|
||||||
builtins.match ".+-tftproot" name != null
|
builtins.match ".+-tftproot" name != null
|
||||||
) self.packages.aarch64-linux
|
) self.packages.aarch64-linux
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue