# flake.nix { inputs = { # flake and infra basics nixpkgs-2211.url = "github:nixos/nixpkgs/nixos-22.11"; nixpkgs-2305.url = "github:nixos/nixpkgs/nixos-23.05"; nixpkgs-2311.url = "github:nixos/nixpkgs/nixos-23.05"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-unstable-small.url = "github:nixos/nixpkgs/nixos-unstable-small"; nixpkgs.follows = "nixpkgs-2311"; flake-parts.url = "github:hercules-ci/flake-parts"; get-flake.url = "github:ursi/get-flake"; srvos.url = "github:numtide/srvos"; srvos.inputs.nixpkgs.follows = "nixpkgs"; nixos-anywhere.url = github:numtide/nixos-anywhere/main; nixos-anywhere.inputs.nixpkgs.follows = "nixpkgs"; disko.follows = "nixos-anywhere/disko"; nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; colmena = { url = "github:zhaofengli/colmena"; inputs.nixpkgs.follows = "nixpkgs"; }; # libraries for building applications fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; crane = { url = "github:ipetkov/crane"; inputs.nixpkgs.follows = "nixpkgs"; }; sops-nix.url = "github:Mic92/sops-nix"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; # applications aphorme_launcher = { url = "github:Iaphetes/aphorme_launcher/main"; flake = false; }; yofi = { url = "github:l4l/yofi/master"; flake = true; inputs.nixpkgs.follows = "nixpkgs"; }; ofi-pass = { url = "github:sereinity/ofi-pass"; flake = false; }; jay = { url = "github:mahkoh/jay"; flake = false; }; magmawm = { url = "github:MagmaWM/MagmaWM"; flake = false; }; salut = { url = "gitlab:snakedye/salut"; flake = false; }; prs = { url = "gitlab:timvisee/prs/master"; flake = false; }; }; outputs = inputs @ { self , flake-parts , nixpkgs , ... }: let inherit (nixpkgs) lib; systems = [ "x86_64-linux" "aarch64-linux" ]; in flake-parts.lib.mkFlake { inherit inputs; } ({ withSystem, ... }: { flake.colmena = lib.lists.foldl (sum: cur: lib.attrsets.recursiveUpdate sum cur) { meta.nixpkgs = import inputs.nixpkgs.outPath { system = builtins.elemAt systems 0; }; } # FIXME: this doesn't seem to work to apply overlays into a node's nixpkgs import # try this instead: https://github.com/zhaofengli/colmena/issues/60#issuecomment-1510496861 (builtins.map (nodeName: import ./nix/os/devices/${nodeName} { inherit nodeName; repoFlake = self; repoFlakeWithSystem = withSystem; nodeFlake = self.inputs.get-flake ./nix/os/devices/${nodeName}; }) [ "steveej-t14" # "elias-e525" # "justyna-p300" # "srv0-dmz0" # # "router0-dmz0" "sj-srv1" "sj-bm-hostkey0" # "retro" ]); # this makes nixos-anywhere work flake.nixosConfigurations = (inputs.colmena.lib.makeHive self.outputs.colmena).nodes // ( let router0-dmz0 = (inputs.get-flake ./nix/os/devices/router0-dmz0).nixosConfigurations; steveej-x13s = (inputs.get-flake ./nix/os/devices/steveej-x13s).nixosConfigurations; retro = (inputs.get-flake ./nix/os/devices/retro).nixosConfigurations; in { router0-dmz0 = router0-dmz0.native; # for now deploy directly with: # nixos-rebuild switch --flake .\#router0-dmz0_cross --build-host localhost --target-host root@192.168.10.1 router0-dmz0_cross = router0-dmz0.cross; # nixos-install --flake .\#retro_cross retro_cross = retro.cross; steveej-x13s_cross = steveej-x13s.cross; } ); inherit systems; perSystem = { inputs' , system , config , lib , pkgs , ... }: rec { imports = [ ./nix/modules/flake-parts/perSystem/default.nix ]; packages = let dcpj4110dw = pkgs.callPackage (self + /nix/pkgs/dcpj4110dw) { }; craneLib = inputs.crane.lib.${system}.overrideToolchain inputs'.fenix.packages.stable.toolchain; craneLibOfiPass = inputs.crane.lib.${system}.overrideToolchain ( inputs'.fenix.packages.stable.toolchain # .override { # date = "1.60.0"; # } ); in { dcpj4110dwDriver = dcpj4110dw.driver; dcpj4110dwCupswrapper = dcpj4110dw.cupswrapper; # broken as of 2023-04-27 because it doesn't load without a config # aphorme_launcher = craneLib.buildPackage {src = inputs.aphorme_launcher;}; # yofi = inputs'.yofi.packages.default; # ofi-pass = craneLibOfiPass.buildPackage {src = inputs.ofi-pass;}; inherit (inputs'.colmena.packages) colmena; # jay = pkgs.callPackage (self + /nix/pkgs/jay.nix) { # src = inputs.jay; # rustPlatform = pkgs.makeRustPlatform { # cargo = inputs'.fenix.packages.stable.toolchain; # rustc = inputs'.fenix.packages.stable.toolchain; # }; # }; # magmawm = pkgs.callPackage (self + /nix/pkgs/magmawm.nix) { # inherit craneLib; # src = inputs.magmawm; # }; salut = craneLib.buildPackage { src = inputs.salut; nativeBuildInputs = [ pkgs.pkg-config ]; buildInputs = [ pkgs.libxkbcommon pkgs.fontconfig ]; }; prs = pkgs.callPackage ({ pkgs , dbus , glib , gpgme , gtk3 , libxcb , libxkbcommon , installShellFiles , pkg-config , python3 }: craneLib.buildPackage { pname = "prs"; version = inputs.prs.shortRev; src = inputs.prs; nativeBuildInputs = [ gpgme installShellFiles pkg-config python3 ]; buildInputs = [ dbus glib gpgme gtk3 libxcb libxkbcommon ]; cargoExtraArgs = "--features backend-gpgme"; postInstall = '' for shell in bash fish zsh; do installShellCompletion --cmd prs --$shell <($out/bin/prs internal completions $shell --stdout) done ''; }) { }; nomad = inputs'.nixpkgs-unstable.legacyPackages.nomad_1_6; ledger-live-desktop-wrapped = pkgs.writeShellScriptBin "ledger-live-desktop-wrapped" '' set -x pkill -9 wayland-proxy-v export NIXOS_OZONE_WL="" ${pkgs.wayland-proxy-virtwl}/bin/wayland-proxy-virtwl \ --wayland-display=wayland-3 \ --xwayland-binary=${pkgs.xwayland}/bin/Xwayland \ --x-display=3 \ & # --x-unscale=3 \ #--verbose \ export PROXYPID="$!" trap "kill -9 \$PROXYPID" EXIT # trap "pkill -9 wayland-proxy-v" EXIT env \ WAYLAND_DISPLAY=wayland-3 \ DISPLAY=:3 \ ledger-live-desktop ''; syncthing-container-webui = pkgs.writeShellScriptBin "reverse-port-forward-syncthing-container" '' ssh root@${self.colmena.sj-vps-htz0.deployment.targetHost} -L 8385:syncthing.containers:8384 ''; }; formatter = pkgs.alejandra; devShells.default = import ./nix/devShells.nix { inherit inputs' pkgs; packages' = packages; }; }; }); }