2023-03-21 13:38:03 +01:00
|
|
|
# flake.nix
|
|
|
|
{
|
|
|
|
inputs = {
|
2023-05-21 11:58:57 +02:00
|
|
|
# flake and infra basics
|
2023-07-05 15:55:04 +02:00
|
|
|
nixpkgs-2211.url = "github:nixos/nixpkgs/nixos-22.11";
|
|
|
|
nixpkgs-2305.url = "github:nixos/nixpkgs/nixos-23.05";
|
2023-08-08 17:50:44 +02:00
|
|
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
2023-08-08 20:39:41 +02:00
|
|
|
nixpkgs-unstable-small.url = "github:nixos/nixpkgs/nixos-unstable-small";
|
2023-07-05 15:55:04 +02:00
|
|
|
nixpkgs.follows = "nixpkgs-2305";
|
2023-04-15 12:21:22 +02:00
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
get-flake.url = "github:ursi/get-flake";
|
2023-07-06 22:42:24 +02:00
|
|
|
|
|
|
|
srvos.url = "github:numtide/srvos";
|
|
|
|
srvos.inputs.nixpkgs.follows = "nixpkgs";
|
2023-04-25 22:06:14 +02:00
|
|
|
nixos-anywhere.url = github:numtide/nixos-anywhere/main;
|
|
|
|
nixos-anywhere.inputs.nixpkgs.follows = "nixpkgs";
|
2023-07-06 22:42:24 +02:00
|
|
|
disko.follows = "nixos-anywhere/disko";
|
2023-05-21 11:58:57 +02:00
|
|
|
|
2023-05-23 18:11:30 +02:00
|
|
|
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
|
|
|
|
|
2023-05-21 11:58:57 +02:00
|
|
|
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";
|
|
|
|
};
|
|
|
|
|
2023-07-05 15:55:04 +02:00
|
|
|
sops-nix.url = "github:Mic92/sops-nix";
|
|
|
|
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
2023-05-21 11:58:57 +02:00
|
|
|
# applications
|
|
|
|
aphorme_launcher = {
|
|
|
|
url = "github:Iaphetes/aphorme_launcher/main";
|
|
|
|
flake = false;
|
|
|
|
};
|
2023-05-23 18:11:30 +02:00
|
|
|
|
2023-05-21 11:58:57 +02:00
|
|
|
yofi = {
|
2023-05-23 18:11:30 +02:00
|
|
|
url = "github:l4l/yofi/master";
|
2023-05-21 11:58:57 +02:00
|
|
|
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;
|
|
|
|
};
|
2023-05-23 18:11:30 +02:00
|
|
|
|
|
|
|
salut = {
|
|
|
|
url = "gitlab:snakedye/salut";
|
|
|
|
flake = false;
|
|
|
|
};
|
2023-03-21 13:38:03 +01:00
|
|
|
};
|
|
|
|
|
2023-04-15 12:21:22 +02:00
|
|
|
outputs = inputs @ {
|
2023-03-21 13:38:03 +01:00
|
|
|
self,
|
2023-04-15 12:21:22 +02:00
|
|
|
flake-parts,
|
|
|
|
nixpkgs,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (nixpkgs) lib;
|
|
|
|
|
|
|
|
systems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
];
|
|
|
|
in
|
2023-07-05 15:55:04 +02:00
|
|
|
flake-parts.lib.mkFlake {inherit inputs;}
|
|
|
|
({withSystem, ...}: {
|
2023-04-15 12:21:22 +02:00
|
|
|
flake.colmena =
|
|
|
|
lib.lists.foldl (sum: cur: lib.attrsets.recursiveUpdate sum cur)
|
|
|
|
{
|
|
|
|
meta.nixpkgs = import inputs.nixpkgs.outPath {
|
|
|
|
system = builtins.elemAt systems 0;
|
|
|
|
};
|
|
|
|
}
|
2023-05-23 18:11:30 +02:00
|
|
|
# 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
|
2023-04-15 12:21:22 +02:00
|
|
|
(builtins.map (nodeName:
|
|
|
|
import ./nix/os/devices/${nodeName} {
|
2023-07-05 15:55:04 +02:00
|
|
|
inherit nodeName;
|
2023-04-15 12:21:22 +02:00
|
|
|
repoFlake = self;
|
2023-07-05 15:55:04 +02:00
|
|
|
repoFlakeWithSystem = withSystem;
|
|
|
|
nodeFlake = self.inputs.get-flake ./nix/os/devices/${nodeName};
|
2023-04-15 12:21:22 +02:00
|
|
|
}) [
|
|
|
|
"steveej-t14"
|
2023-07-09 20:15:06 +02:00
|
|
|
"elias-e525"
|
|
|
|
"justyna-p300"
|
2023-08-10 21:45:49 +02:00
|
|
|
|
|
|
|
"srv0-dmz0"
|
|
|
|
"router0-dmz0"
|
|
|
|
|
|
|
|
"sj-vps-htz0"
|
2023-11-23 17:14:15 +01:00
|
|
|
"sj-bm-hostkey0"
|
2023-04-15 12:21:22 +02:00
|
|
|
]);
|
|
|
|
|
2023-04-25 22:06:14 +02:00
|
|
|
# this makes nixos-anywhere work
|
2023-08-10 21:45:49 +02:00
|
|
|
flake.nixosConfigurations =
|
|
|
|
(inputs.colmena.lib.makeHive self.outputs.colmena).nodes
|
|
|
|
// (let
|
|
|
|
router0-dmz0 = (inputs.get-flake ./nix/os/devices/router0-dmz0).nixosConfigurations;
|
|
|
|
in {
|
|
|
|
router0-dmz0 = router0-dmz0.native;
|
2023-08-11 18:54:56 +02:00
|
|
|
|
|
|
|
# for now deploy directly with:
|
|
|
|
# nixos-rebuild switch --flake .\#cross_router0-dmz0 --build-host localhost --target-host root@192.168.10.1
|
2023-08-10 21:45:49 +02:00
|
|
|
cross_router0-dmz0 = router0-dmz0.cross;
|
|
|
|
});
|
2023-04-25 22:06:14 +02:00
|
|
|
|
2023-04-15 12:21:22 +02:00
|
|
|
inherit systems;
|
|
|
|
|
|
|
|
perSystem = {
|
|
|
|
inputs',
|
|
|
|
system,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
2023-05-21 11:58:57 +02:00
|
|
|
}: rec {
|
2023-04-15 12:21:22 +02:00
|
|
|
imports = [
|
|
|
|
./nix/modules/flake-parts/perSystem/default.nix
|
|
|
|
];
|
|
|
|
|
2023-04-25 22:06:14 +02:00
|
|
|
packages = let
|
|
|
|
dcpj4110dw = pkgs.callPackage (self + /nix/pkgs/dcpj4110dw) {};
|
2023-05-21 11:58:57 +02:00
|
|
|
|
|
|
|
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";
|
|
|
|
# }
|
|
|
|
);
|
2023-04-25 22:06:14 +02:00
|
|
|
in {
|
|
|
|
dcpj4110dwDriver = dcpj4110dw.driver;
|
|
|
|
dcpj4110dwCupswrapper = dcpj4110dw.cupswrapper;
|
2023-05-21 11:58:57 +02:00
|
|
|
|
2023-07-07 22:20:39 +02:00
|
|
|
# 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;};
|
2023-05-21 11:58:57 +02:00
|
|
|
|
|
|
|
inherit (inputs'.colmena.packages) colmena;
|
|
|
|
|
2023-07-07 22:20:39 +02:00
|
|
|
# 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;
|
|
|
|
# };
|
2023-05-23 18:11:30 +02:00
|
|
|
|
|
|
|
salut = craneLib.buildPackage {
|
|
|
|
src = inputs.salut;
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgs.pkg-config
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
pkgs.libxkbcommon
|
|
|
|
pkgs.fontconfig
|
|
|
|
];
|
|
|
|
};
|
2023-08-08 17:50:44 +02:00
|
|
|
|
|
|
|
nomad = inputs'.nixpkgs-unstable.legacyPackages.nomad_1_6;
|
2023-10-01 11:08:11 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
2023-10-01 11:08:50 +02:00
|
|
|
|
|
|
|
syncthing-container-webui = pkgs.writeShellScriptBin "reverse-port-forward-syncthing-container" ''
|
|
|
|
ssh root@${self.colmena.sj-vps-htz0.deployment.targetHost} -L 8385:syncthing.containers:8384
|
|
|
|
'';
|
2023-04-25 22:06:14 +02:00
|
|
|
};
|
|
|
|
|
2023-04-15 12:21:22 +02:00
|
|
|
formatter = pkgs.alejandra;
|
2023-05-21 11:58:57 +02:00
|
|
|
devShells.default = import ./nix/devShells.nix {
|
|
|
|
inherit inputs' pkgs;
|
|
|
|
packages' = packages;
|
|
|
|
};
|
2023-04-15 12:21:22 +02:00
|
|
|
};
|
2023-07-05 15:55:04 +02:00
|
|
|
});
|
2023-03-21 13:38:03 +01:00
|
|
|
}
|