428 lines
13 KiB
Nix
428 lines
13 KiB
Nix
# flake.nix
|
|
{
|
|
inputs = {
|
|
# TODO: where has this been used?
|
|
# dotfiles = {
|
|
# url = "git+https://forgejo.www.stefanjunker.de/steveej/dotfiles.git";
|
|
# flake = false;
|
|
# };
|
|
|
|
# flake and infra basics
|
|
nixpkgs-2211.url = "github:nixos/nixpkgs/nixos-22.11";
|
|
radicalePkgs.follows = "nixpkgs-2211";
|
|
nixpkgs-2411.url = "github:nixos/nixpkgs/nixos-24.11";
|
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
nixpkgs.follows = "nixpkgs-2411";
|
|
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";
|
|
|
|
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
|
|
nixpkgs-vscodium.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
# needs to be in sync with `vscodium --version` from `nixpkgs-vscodium`
|
|
openvscode-server.url = "github:gitpod-io/openvscode-server/openvscode-server-v1.88.1";
|
|
openvscode-server.flake = false;
|
|
|
|
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";
|
|
|
|
sops-nix = {
|
|
url = "github:Mic92/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;
|
|
};
|
|
|
|
prs = {
|
|
# url = "gitlab:timvisee/prs/v0.5.2";
|
|
url = "gitlab:timvisee/prs/07f17a93d19fb6bc92c9c7f3ae3f5cc750b1f973";
|
|
flake = false;
|
|
};
|
|
|
|
rperf = {
|
|
url = "github:steveej-forks/rperf";
|
|
flake = false;
|
|
};
|
|
|
|
# nixpkgs-logseq.url = "github:steveej-forks/nixpkgs/logseq-linux-arm64-selfbuilt-appimage";
|
|
|
|
espanso = {
|
|
flake = false;
|
|
url = "github:espanso/espanso/db97658d1d80697a635b57801696c594eacf057b";
|
|
};
|
|
|
|
nix4vscode = {
|
|
url = "github:nix-community/nix4vscode";
|
|
# inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
nixvim = {
|
|
# TODO: pin to nixos-24.11 once available
|
|
url = "github:nix-community/nixvim";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
treefmt-nix = {
|
|
url = "github:numtide/treefmt-nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
nixago = {
|
|
url = "github:jmgilman/nixago";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
nur = {
|
|
url = "github:nix-community/NUR";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
nixpkgs-gimp.url = "github:jtojnar/nixpkgs/gimp-meson";
|
|
};
|
|
|
|
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 (self + "/nix/os/devices/${nodeName}");
|
|
}
|
|
)
|
|
[
|
|
"steveej-t14"
|
|
"steveej-x13s"
|
|
"steveej-x13s-rmvbl"
|
|
# "elias-e525"
|
|
# "justyna-p300"
|
|
|
|
# "srv0-dmz0"
|
|
# "router0-dmz0"
|
|
"router0-ifog"
|
|
"router0-hosthatch"
|
|
|
|
"sj-srv1"
|
|
]
|
|
);
|
|
|
|
flake.lib = {
|
|
inherit withSystem;
|
|
};
|
|
|
|
# this makes nixos-anywhere work
|
|
flake.nixosConfigurations =
|
|
let
|
|
colmenaHive = (inputs.colmena.lib.makeHive self.outputs.colmena).nodes;
|
|
router0-dmz0 = (inputs.get-flake (self + "/nix/os/devices/router0-dmz0")).nixosConfigurations;
|
|
in
|
|
colmenaHive
|
|
// {
|
|
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;
|
|
|
|
steveej-x13s_cross =
|
|
(inputs.get-flake (self + "./nix/os/devices/steveej-x13s")).nixosConfigurations.cross;
|
|
steveej-x13s-rmvbl_cross =
|
|
(inputs.get-flake ./nix/os/devices/steveej-x13s-rmvbl).nixosConfigurations.cross;
|
|
};
|
|
|
|
inherit systems;
|
|
|
|
perSystem =
|
|
{
|
|
self',
|
|
inputs',
|
|
system,
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
imports = [ ./nix/modules/flake-parts/perSystem/default.nix ];
|
|
|
|
packages =
|
|
let
|
|
dcpj4110dw = pkgs.callPackage (self + /nix/pkgs/dcpj4110dw) { };
|
|
|
|
craneLibFn = (inputs.crane.mkLib inputs.nixpkgs.legacyPackages.${system}).overrideToolchain;
|
|
|
|
craneLib = craneLibFn inputs'.fenix.packages.stable.toolchain;
|
|
|
|
_prsPackage =
|
|
{
|
|
lib,
|
|
rustPlatform,
|
|
installShellFiles,
|
|
pkg-config,
|
|
python3,
|
|
glib,
|
|
gpgme,
|
|
gtk3,
|
|
stdenv,
|
|
cargoHash ? "sha256-T57RqIzurpYLHyeFhvqxmC+DoB6zUf+iTu1YkMmwtp8=",
|
|
src,
|
|
version,
|
|
makeWrapper,
|
|
skim,
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "prs";
|
|
|
|
inherit src version cargoHash;
|
|
|
|
nativeBuildInputs = [
|
|
gpgme
|
|
installShellFiles
|
|
pkg-config
|
|
python3
|
|
makeWrapper
|
|
];
|
|
|
|
cargoBuildFlags = [
|
|
"--no-default-features"
|
|
"--features=alias,backend-gpgme,clipboard,notify,select-fzf-bin,select-skim-bin,tomb,totp"
|
|
];
|
|
|
|
buildInputs = [
|
|
glib
|
|
gpgme
|
|
gtk3
|
|
];
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
for shell in bash fish zsh; do
|
|
installShellCompletion --cmd prs --$shell <($out/bin/prs internal completions $shell --stdout)
|
|
done
|
|
'';
|
|
|
|
postFixup = ''
|
|
wrapProgram $out/bin/prs \
|
|
--prefix PATH : ${lib.makeBinPath [ skim ]}
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Secure, fast & convenient password manager CLI using GPG and git to sync";
|
|
homepage = "https://gitlab.com/timvisee/prs";
|
|
changelog = "https://gitlab.com/timvisee/prs/-/blob/v${version}/CHANGELOG.md";
|
|
license = with licenses; [
|
|
lgpl3Only # lib
|
|
gpl3Only # everything else
|
|
];
|
|
maintainers = with maintainers; [ dotlambda ];
|
|
mainProgram = "prs";
|
|
};
|
|
};
|
|
|
|
local-xwayland = pkgs.writeShellScriptBin "local-xwayland" ''
|
|
set -x
|
|
${pkgs.wayland-proxy-virtwl}/bin/wayland-proxy-virtwl \
|
|
--wayland-display=wayland-3 \
|
|
--xwayland-binary=${pkgs.xwayland}/bin/Xwayland \
|
|
--x-display=0 \
|
|
# --x-unscale=3 \
|
|
--verbose
|
|
'';
|
|
in
|
|
{
|
|
dcpj4110dwDriver = dcpj4110dw.driver;
|
|
dcpj4110dwCupswrapper = dcpj4110dw.cupswrapper;
|
|
|
|
inherit (inputs'.colmena.packages) colmena;
|
|
|
|
prs = pkgs.callPackage _prsPackage {
|
|
src = inputs.prs;
|
|
version = inputs.prs.shortRev;
|
|
cargoHash = "sha256-oXuAKOHIfwUvcS0qXDTe68DN+MUNS4TAKV986vxdeh8=";
|
|
};
|
|
|
|
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
|
|
'';
|
|
|
|
rperf = craneLib.buildPackage {
|
|
src = inputs.rperf;
|
|
nativeBuildInputs = [ pkgs.pkg-config ];
|
|
buildInputs = [ ];
|
|
};
|
|
|
|
inherit local-xwayland;
|
|
|
|
inherit (inputs'.nixpkgs-gimp.legacyPackages) gimp;
|
|
|
|
};
|
|
|
|
formatter =
|
|
let
|
|
settingsNix = {
|
|
projectRootFile = ".git/config";
|
|
|
|
package = inputs'.nixpkgs-unstable.legacyPackages.treefmt2;
|
|
|
|
programs = {
|
|
nixfmt.enable = true;
|
|
deadnix.enable = true;
|
|
statix.enable = true;
|
|
|
|
shfmt.enable = true;
|
|
shellcheck.enable = true;
|
|
|
|
prettier.enable = true;
|
|
just = {
|
|
enable = true;
|
|
includes = [
|
|
"*/Justfile"
|
|
"Justfile"
|
|
];
|
|
};
|
|
} // pkgs.lib.optionalAttrs (pkgs.system != "riscv64-linux") { shellcheck.enable = true; };
|
|
|
|
settings = {
|
|
global.excludes = [
|
|
"LICENSE"
|
|
"secrets/"
|
|
".git-crypt/"
|
|
|
|
# unsupported extensions
|
|
"*.{enc,gif,png,svg,tape,mts,lock,mod,sum,toml,env,envrc,gitignore}"
|
|
];
|
|
|
|
formatter = {
|
|
deadnix = {
|
|
priority = 1;
|
|
options = [ "--no-underscore" ];
|
|
};
|
|
|
|
nixfmt = {
|
|
priority = 2;
|
|
};
|
|
|
|
statix = {
|
|
priority = 3;
|
|
};
|
|
|
|
prettier = {
|
|
options = [
|
|
"--tab-width"
|
|
"2"
|
|
];
|
|
includes = [ "*.{css,html,js,json,jsx,md,mdx,scss,ts,yaml}" ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
eval = inputs.treefmt-nix.lib.evalModule pkgs settingsNix;
|
|
in
|
|
eval.config.build.wrapper.overrideAttrs (_: {
|
|
passthru = {
|
|
inherit (eval.config) package settings;
|
|
};
|
|
});
|
|
|
|
devShells =
|
|
let
|
|
all = import ./nix/devShells.nix {
|
|
inherit
|
|
self
|
|
self'
|
|
inputs'
|
|
pkgs
|
|
;
|
|
};
|
|
in
|
|
all
|
|
// {
|
|
default = all.develop;
|
|
};
|
|
};
|
|
}
|
|
);
|
|
}
|