Compare commits

..

No commits in common. "ab3e8c6a9eefc4ad94defbb7918e56418a25e43b" and "34ef52d5b48a3839a054e48909feeb3e056783b6" have entirely different histories.

80 changed files with 913 additions and 2190 deletions

View File

@ -4,21 +4,17 @@
# Should also incorporate shortcuts like scripts/{hm-switch,conf-sysnix}.sh in here instead # Should also incorporate shortcuts like scripts/{hm-switch,conf-sysnix}.sh in here instead
# #
# It should not contain PDE # It should not contain PDE
{ pkgs ? import <nixpkgs> { } {pkgs? import <nixpkgs> {}
, lib ,lib
, ... ,...}: pkgs.mkShell {
}: pkgs.mkShell {
# mkShell doesn't care about the differences across nativeBuildInputs, # mkShell doesn't care about the differences across nativeBuildInputs,
# buildInputs, or packages # buildInputs, or packages
buildInputs = [ buildInputs = [
# shell scripts # shell scripts
(lib.shellAsDrv { script = ''echo "hello world"''; pname = "hello"; }) (lib.shellAsDrv {script = ''echo "hello world"''; pname = "hello";})
# TODO: decompose hm-switch.sh with a base version (where HOME_MANAGER_BIN is injected)
# (lib.shellAsDrv {script = builtins.readFile ./scripts/hm-switch.sh; pname = "hm-switch";})
pkgs.rust4cargo
]; ];
# env vars # env vars
lol = "hello world"; lol="hello world";
} }

View File

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1673301561, "lastModified": 1665870395,
"narHash": "sha256-gRUWHbBAtMuPDJQXotoI8u6+3DGBIUZHkyQWpIv7WpM=", "narHash": "sha256-Tsbqb27LDNxOoPLh0gw2hIb6L/6Ow/6lIBvqcHzEKBI=",
"owner": "ryantm", "owner": "ryantm",
"repo": "agenix", "repo": "agenix",
"rev": "42d371d861a227149dc9a7e03350c9ab8b8ddd68", "rev": "a630400067c6d03c9b3e0455347dc8559db14288",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -36,22 +36,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1668681692,
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1667395993,
@ -69,11 +53,11 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1659877975,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -97,21 +81,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_4": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -120,11 +89,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1673343300, "lastModified": 1672770368,
"narHash": "sha256-5Xdj6kpXYMie0MlnGwqK5FaMdsedxvyuakWtyKB3zaQ=", "narHash": "sha256-iO6Z9blIe8dcPh3VT2nkej9EimORCoskGQR6xNjICWI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "176e455371a8371586e8a3ff0d56ee9f3ca2324e", "rev": "d01e7280ad7d13a5a0fae57355bd0dbfe5b81969",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -149,74 +118,10 @@
"type": "github" "type": "github"
} }
}, },
"neovim-flake": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
]
},
"locked": {
"dir": "contrib",
"lastModified": 1673504032,
"narHash": "sha256-x4nv7g8+bQXg5PfkFw3vCcr3pYI0Hco0VoSbAy60xek=",
"owner": "neovim",
"repo": "neovim",
"rev": "143d3f1f3224bca02bfef7df0932b9d7524a3ff2",
"type": "github"
},
"original": {
"dir": "contrib",
"owner": "neovim",
"repo": "neovim",
"type": "github"
}
},
"neovim-nightly-overlay": {
"inputs": {
"flake-compat": "flake-compat_2",
"neovim-flake": "neovim-flake",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1673511313,
"narHash": "sha256-QGUT3w1bHclVRqX958EPOd3OxR/R10MoV97N5jx/qbw=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "5af6fe31f9906e70a1e8985dbbdcc4ae66c7f82d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"type": "github"
}
},
"nix-index-database": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1673365945,
"narHash": "sha256-/duo8kCEbo62D5gn46m//jfvRtT56KS5dy+j6+Rl+4Y=",
"owner": "mic92",
"repo": "nix-index-database",
"rev": "0e51ff44d6bef0b6b2bbf9e34fdc029fc24820fc",
"type": "github"
},
"original": {
"owner": "mic92",
"repo": "nix-index-database",
"type": "github"
}
},
"nixgl": { "nixgl": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1, "lastModified": 1,
@ -230,22 +135,6 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1671983799,
"narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1660551188, "lastModified": 1660551188,
"narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=",
@ -260,13 +149,13 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1673450908, "lastModified": 1672617983,
"narHash": "sha256-b8em+kwrNtnB7gR8SyVf6WuTyQ+6tHS6dzt9D9wgKF0=", "narHash": "sha256-68WDiCBs631mbDDk4UAKdGURKcsfW6hjb7wgudTAe5o=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6c8644fc37b6e141cbfa6c7dc8d98846c4ff0c2e", "rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -275,7 +164,7 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_4": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1665296151, "lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
@ -298,24 +187,22 @@
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager",
"kpcli-py": "kpcli-py", "kpcli-py": "kpcli-py",
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-index-database": "nix-index-database",
"nixgl": "nixgl", "nixgl": "nixgl",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_2",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1673490397, "lastModified": 1672712534,
"narHash": "sha256-VCSmIYJy/ZzTvEGjdfITmTYfybXBgZpMjyjDndbou+8=", "narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "0833f4d063a2bb75aa31680f703ba594a384ffe6", "rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f",
"type": "github" "type": "github"
}, },
"original": { "original": {

162
flake.nix
View File

@ -22,115 +22,79 @@
url = "github:rebkwok/kpcli"; url = "github:rebkwok/kpcli";
flake = false; flake = false;
}; };
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836";
};
nix-index-database = {
url = "github:mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs = {
{ nixpkgs nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
, agenix ,...
, home-manager }@_inputs: let
, flake-utils # Context/global stuffs to be passed down
, nixgl # TODO: adapt to different platforms think about different systems later
, rust-overlay system = "x86_64-linux";
, flake-compat pkgs = import nixpkgs {
, neovim-nightly-overlay inherit system;
, nix-index-database overlays = import ./overlays.nix _inputs;
, ... config = {
}@_inputs: allowUnfree = true;
let };
# Context/global stuffs to be passed down };
# inject nixpkgs.lib onto c_ (calculus)
_lib = pkgs.lib;
inputs = (_lib.recursiveUpdate {
inherit system;
# NOTE: this will only read files that are within git tree # NOTE: this will only read files that are within git tree
# all secrets should go into secrets.nix and secrets/*.age # all secrets should go into secrets.nix and secrets/*.age
proj_root = proj_root = let
let path = builtins.toString ./.;
path = builtins.toString ./.; in {
in inherit path;
{ configs.path = "${path}/native-configs";
inherit path; scripts.path = "${path}/scripts";
configs.path = "${path}/native_configs"; secrets.path = "${path}/secrets";
scripts.path = "${path}/scripts"; testdata.path = "${path}/tests";
secrets.path = "${path}/secrets"; modules.path = "${path}/modules";
testdata.path = "${path}/tests"; hosts.path = "${path}/hosts";
modules.path = "${path}/modules"; users.path = "${path}/users";
hosts.path = "${path}/hosts";
users.path = "${path}/users";
};
# TODO: adapt to different platforms think about different systems later
system = "x86_64-linux";
overlays = [
rust-overlay.overlays.default
(self: pkgs@{ lib, ... }: {
lib = pkgs.lib // (import ./lib (_inputs // { inherit pkgs proj_root; }));
})
];
pkgs = import nixpkgs {
inherit system;
overlays = import ./overlays.nix _inputs;
config = {
allowUnfree = true;
};
}; };
# now, this lib is extremely powerful as it also engulfs nixpkgs.lib } _inputs);
# lib = nixpkgs.lib // pkgs.lib; inputs_w_pkgs = (_lib.recursiveUpdate {inherit pkgs; lib = pkgs.lib;} inputs);
lib = (builtins.foldl' (lhs: rhs: (nixpkgs.lib.recursiveUpdate lhs rhs)) { } [ lib = _lib.recursiveUpdate (import ./lib inputs_w_pkgs) _lib;
nixpkgs.lib
pkgs.lib
(import ./lib {
inherit proj_root pkgs overlays system;
inherit (pkgs) lib;
})
]);
inputs_w_lib = (pkgs.lib.recursiveUpdate _inputs {
inherit system proj_root pkgs lib;
});
modules = (import ./modules inputs_w_lib); # update inputs with our library and past onto our end configurations
hosts = (import ./hosts inputs_w_lib); inputs_w_lib = (lib.recursiveUpdate {inherit lib;} inputs_w_pkgs);
users = (import ./users inputs_w_lib); modules = (import ./modules inputs_w_lib);
hosts = (import ./hosts inputs_w_lib);
users = (import ./users inputs_w_lib);
# {nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
# ,pkgs, lib (extended), proj_root}
final_inputs = inputs_w_lib;
# {nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat # Tests: unit + integration
# ,pkgs, lib (extended), proj_root} unit_tests = (import ./lib/test.nix final_inputs) //
final_inputs = inputs_w_lib; {
test_example = {
# Tests: unit + integration expr = "names must start with 'test'";
unit_tests = (import ./lib/test.nix final_inputs) // expected = "or won't show up";
{
test_example = {
expr = "names must start with 'test'";
expected = "or won't show up";
};
not_show = {
expr = "this will be ignored by lib.runTests";
expected = "for sure";
};
}; };
secrets = import ./secrets final_inputs; not_show = {
expr = "this will be ignored by lib.runTests";
in expected = "for sure";
{
inherit (hosts) nixosConfigurations;
inherit (users) homeConfigurations;
inherit lib proj_root;
devShell."${system}" = import ./dev-shell.nix final_inputs;
templates = import ./templates final_inputs;
secrets = {
pubKeys = {
hosts = hosts.pubKeys;
users = users.pubKeys;
}; };
}; };
unit_tests = lib.runTests unit_tests; in {
debug = { inherit (hosts) nixosConfigurations;
inherit final_inputs hosts users modules lib inputs_w_lib unit_tests pkgs nixpkgs; # inherit (users) homeConfigurations;
}; inherit lib;
formatter."${system}" = pkgs.nixpkgs-fmt; devShell."${system}" = import ./dev-shell.nix final_inputs;
templates = import ./templates final_inputs;
unit_tests = lib.runTests unit_tests;
secrets = import ./secrets final_inputs;
debug = {
inherit final_inputs hosts users modules lib inputs_w_pkgs unit_tests pkgs;
}; };
};
} }

View File

@ -1,12 +1,5 @@
{ nixpkgs {nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
, agenix ,pkgs, lib, proj_root}: {
, home-manager
, flake-utils }
, nixgl
, rust-overlay
, flake-compat
, pkgs
, lib
, proj_root
}: { }

View File

@ -5,28 +5,24 @@
{ {
imports = imports =
[ [ (modulesPath + "/installer/scan/not-detected.nix")
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.loader.systemd-boot.enable = true;
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
# boot.initrd.kernelModules = [ "amdgpu" ]; # boot.initrd.kernelModules = [ "amdgpu" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-amd" "coretemp" ]; boot.kernelModules = [ "kvm-amd" "coretemp"];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
# Might be wise to use /dev/nvme0p1 instead # Might be wise to use /dev/nvme0p1 instead
{ { device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2";
device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" =
# Might be wise to use /dev/nvme0p2 instead # Might be wise to use /dev/nvme0p2 instead
{ { device = "/dev/disk/by-uuid/EBA6-394D";
device = "/dev/disk/by-uuid/EBA6-394D";
fsType = "vfat"; fsType = "vfat";
}; };

View File

@ -1,87 +1,64 @@
{ nixpkgs {nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
, agenix ,pkgs, lib, proj_root, nixosDefaultVersion? "22.05", defaultSystem? "x86_64-linux",...}@finalInputs: let
, home-manager config = {
, flake-utils bao.metadata = {
, nixgl # req
, rust-overlay hostName = "bao";
, flake-compat # opts
, pkgs ssh_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBuAaAE7TiQmMH300VRj/pYCri1qPmHjd+y9aX2J0Fs";
, lib nixosVersion = "22.11";
, proj_root system = "x86_64-linux";
, nixosDefaultVersion ? "22.05" preset = "base";
, defaultSystem ? "x86_64-linux" };
, ... bao.nixosConfig = {
}@finalInputs: modules = [
let import ../modules/kde.sys.nix
config = { import ../modules/pulseaudio.sys.nix
bao.metadata = { import ../modules/storage.perso.sys.nix
# req ];
hostName = "bao"; };
# opts };
ssh_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBuAaAE7TiQmMH300VRj/pYCri1qPmHjd+y9aX2J0Fs"; propagate = hostConfig@{metadata, nixosConfig}: let
nixosVersion = "22.11"; # req
system = "x86_64-linux"; inherit (metadata) hostName;
preset = "base"; # opts
}; ssh_pubkey = lib.attrByPath ["ssh_pubkey"] null metadata; # metadata.ssh_pubkey??undefined
# TODO: add override so that we can add wsl config on top users = lib.attrByPath ["users"] {} metadata;
bao.nixosConfig = { nixosVersion = lib.attrByPath ["nixosVersion"] nixosDefaultVersion metadata;
modules = [ system = lib.attrByPath ["system"] defaultSystem metadata;
(import ../modules/nvgpu.sys.nix) preset = lib.attrByPath ["preset"] "base" metadata;
(import ../modules/kde.sys.nix) # infer
(import ../modules/pulseaudio.sys.nix) hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix";
(import ../modules/storage.perso.sys.nix) in {
]; inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig;
}; nixosConfig = nixosConfig // {
inherit system;
lib = finalInputs.lib;
modules = [
{
system.stateVersion = nixosVersion;
networking.hostName = hostName;
users.users = users;
}
{
_module.args = finalInputs;
}
import "${proj_root.modules.path}/secrets.nix"
import "${proj_root.modules.path}/${preset}.sys.nix"
] ++ nixosConfig.modules;
};
};
mkHostFromPropagated = propagatedHostConfig@{nixosConfig,...}: nixpkgs.lib.nixosSystem nixosConfig;
mkHost = hostConfig: (lib.pipe [propagate mkHostFromPropagated] hostConfig);
trimNull = lib.filterAttrsRecursive (name: value: value != null);
flattenPubkey = lib.mapAttrs (hostName: meta_config: meta_config.metadata.ssh_pubkey);
in {
inherit config;
# nixosConfigurations = lib.mapAttrs (name: hostConfig: mkHost hostConfig) config;
nixosConfigurations = {};
debug = {
propagated = lib.mapAttrs (name: hostConfig: propagate hostConfig) config;
}; };
propagate = hostConfig@{ metadata, nixosConfig }:
let
# req
inherit (metadata) hostName;
# opts
ssh_pubkey = lib.attrByPath [ "ssh_pubkey" ] null metadata; # metadata.ssh_pubkey??undefined
users = lib.attrByPath [ "users" ] { } metadata;
nixosVersion = lib.attrByPath [ "nixosVersion" ] nixosDefaultVersion metadata;
system = lib.attrByPath [ "system" ] defaultSystem metadata;
preset = lib.attrByPath [ "preset" ] "base" metadata;
# infer
hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix";
# alias to prevent infinite recursion
_nixosConfig = nixosConfig;
in
{
inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig;
nixosConfig = _nixosConfig // {
inherit system;
modules = [
{
config._module.args = {
inherit proj_root;
my-lib = finalInputs.lib;
};
}
hardwareConfig
{
system.stateVersion = nixosVersion;
networking.hostName = hostName;
users.users = users;
}
{
imports = [ agenix.nixosModule ];
environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ];
}
(import "${proj_root.modules.path}/secrets.nix")
(import "${proj_root.modules.path}/${preset}.sys.nix")
] ++ _nixosConfig.modules;
};
};
# we are blessed by the fact that we engulfed nixpkgs.lib.* at top level
mkHostFromPropagated = propagatedHostConfig@{ nixosConfig, ... }: nixpkgs.lib.nixosSystem nixosConfig;
mkHost = hostConfig: (lib.pipe [ propagate mkHostFromPropagated ] hostConfig);
trimNull = lib.filterAttrsRecursive (name: value: value != null);
flattenPubkey = lib.mapAttrs (hostName: meta_config: meta_config.metadata.ssh_pubkey);
in
{
nixosConfigurations = lib.mapAttrs (name: hostConfig: mkHost hostConfig) config;
# {bao = "ssh-ed25519 ..."; another_host = "ssh-rsa ...";} # {bao = "ssh-ed25519 ..."; another_host = "ssh-rsa ...";}
pubKeys = lib.getPubkey config; hostKeys = trimNull (flattenPubkey config);
} }

View File

@ -5,8 +5,7 @@
{ {
imports = imports =
[ [ (modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
@ -24,13 +23,13 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ { device = "/dev/sda";
device = "/dev/sda";
fsType = "ext4"; fsType = "ext4";
}; };
swapDevices = swapDevices =
[{ device = "/dev/sdb"; }]; [ { device = "/dev/sdb"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@ -1,11 +1,4 @@
{ nixpkgs {nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
, agenix ,pkgs, lib, proj_root}: {
, home-manager
, flake-utils }
, nixgl
, rust-overlay
, flake-compat
, pkgs
, lib
, proj_root
}: { }

View File

@ -5,8 +5,7 @@
{ {
imports = imports =
[ [ (modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
@ -14,7 +13,7 @@
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
boot.kernelParams = [ "console=ttyS0,19200n8" ]; boot.kernelParams = ["console=ttyS0,19200n8"];
boot.loader.grub.extraConfig = '' boot.loader.grub.extraConfig = ''
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
terminal_input serial; terminal_input serial;
@ -24,13 +23,13 @@
boot.loader.grub.device = "nodev"; boot.loader.grub.device = "nodev";
boot.loader.timeout = 10; boot.loader.timeout = 10;
fileSystems."/" = fileSystems."/" =
{ { device = "/dev/sda";
device = "/dev/sda";
fsType = "ext4"; fsType = "ext4";
}; };
swapDevices = swapDevices =
[{ device = "/dev/sdb"; }]; [ { device = "/dev/sdb"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@ -1 +0,0 @@

View File

@ -1,35 +1,22 @@
{ pkgs {pkgs
# ,nixpkgs ,nixpkgs
, proj_root ,proj_root
# ,agenix ,agenix
, nixosDefaultVersion ? "22.05" ,nixosDefaultVersion? "22.05"
, defaultSystem ? "x86_64-linux" ,defaultSystem? "x86_64-linux"
, ... ,...}@inputs: let
}@inputs:
let
lib = pkgs.lib; lib = pkgs.lib;
inputs_w_lib = (inputs // { inherit lib; }); serde = import ./serde.nix inputs // {inherit lib;};
serde = import ./serde.nix inputs_w_lib;
shellAsDrv = { script, pname }: (pkgs.callPackage
(
# just a pattern that we must remember: args to this are children of pkgs.
{ writeShellScriptBin }: writeShellScriptBin pname script
)
{ });
trimNull = lib.filterAttrs (name: value: value != null);
# ssh
flattenPubkey = lib.mapAttrs (_identity: meta_config: lib.attrByPath [ "metadata" "ssh_pubkey" ] null meta_config);
getPubkey = config: (lib.pipe config [ flattenPubkey trimNull ]);
# procedure = # procedure =
in in {
{
# short-hand to create a shell derivation # short-hand to create a shell derivation
# NOTE: this is pure. This means, env vars from devShells might not # NOTE: this is pure. This means, env vars from devShells might not
# be accessible unless MAYBE they are `export`ed # be accessible unless MAYBE they are `export`ed
inherit shellAsDrv trimNull flattenPubkey getPubkey; shellAsDrv = {script, pname}: (pkgs.callPackage (
ssh = { # just a pattern that we must remember: args to this are children of pkgs.
inherit flattenPubkey getPubkey; {writeShellScriptBin}: writeShellScriptBin pname script
}; ) {});
# Configures hosts as nixosConfiguration # Configures hosts as nixosConfiguration
# mkHost = {hostName # mkHost = {hostName
# , nixosBareConfiguration # , nixosBareConfiguration

View File

@ -3,9 +3,9 @@
# TODO: Add to* formats from pkgs.formats.* # TODO: Add to* formats from pkgs.formats.*
{ pkgs { pkgs
, lib , lib
, ... ,...
} @ inputs: } @ inputs:
let let
yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage
({ runCommand }: ({ runCommand }:
# runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33 # runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33
@ -16,16 +16,14 @@ let
echo "$yamlContent" | yq >$out echo "$yamlContent" | yq >$out
'') '')
{ }; { };
in in {
{
# Takes in a yaml string and produces a derivation with translated JSON at $outputPath # Takes in a yaml string and produces a derivation with translated JSON at $outputPath
# similar to builtins.fromJSON, turns a YAML string to nix attrset # similar to builtins.fromJSON, turns a YAML string to nix attrset
fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json")); fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json"));
fromYamlPath = yamlPath: builtins.fromJSON ( fromYamlPath = yamlPath: builtins.fromJSON (
builtins.readFile ( builtins.readFile (
yamlToJsonDrv yamlToJsonDrv (
( builtins.readFile yamlPath)
builtins.readFile yamlPath) "any-output.json"));
"any-output.json"));
# TODO: fromToml? # TODO: fromToml?
} }

View File

@ -1 +1,3 @@
{ lib, ... }: { } {lib,...}: {
}

View File

@ -1,6 +0,0 @@
{
imports = [ ./gpu.sys.nix ];
boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.enable = true;
services.xserver.videoDrivers = [ "amdgpu" ];
}

View File

@ -1,15 +1,14 @@
{ pkgs {pkgs
, lib ,lib
, proj_root ,proj_root
, ... }:{
}: {
imports = [ imports = [
./minimal.sys.nix ./minimal.sys.nix
./mosh.sys.nix ./mosh.sys.nix
./tailscale.sys.nix ./tailscale.sys.nix
./ssh.sys.nix ./ssh.sys.nix
]; ];
environment.systemPackages = [ pkgs.lm_sensors ]; environment.systemPackages = [pkgs.lm_sensors];
time.timeZone = "America/Phoenix"; time.timeZone = "America/Phoenix";
} }

View File

@ -1 +1 @@
inputs: { } inputs: {}

View File

@ -1,12 +0,0 @@
{ pkgs, ... }: {
environment.systemPackages = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ];
hardware.opengl = {
enable = true;
extraPackages = [ pkgs.rocm-opencl-icd pkgs.rocm-opencl-runtime ];
# Vulkan
driSupport = true;
driSupport32Bit = true;
package = pkgs.mesa.drivers;
package32 = pkgs.pkgsi686Linux.mesa.drivers;
};
}

View File

@ -1,8 +1,7 @@
{ pkgs { pkgs
, my-lib , lib
, ...
}: { }: {
environment.noXlibs = my-lib.mkForce false; environment.noXlibs = lib.mkForce false;
# TODO: wireless networking # TODO: wireless networking
# Enable the X11 windowing system. # Enable the X11 windowing system.

View File

@ -1,21 +1,18 @@
{ pkgs {pkgs
, lib ,lib
, proj_root ,proj_root
, modulesPath }:{
, ...
}: {
imports = [ "${modulesPath}/profiles/minimal.nix" ];
# prune old builds after a while # prune old builds after a while
nix.settings.auto-optimise-store = true; nix.settings.auto-optimize-store = true;
nix.package = pkgs.nixFlakes; # nix flakes nix.package = pkgs.nixFlakes; # nix flakes
nix.extraOptions = '' nix.extraOptions = ''
experimental-features = nix-command flakes experimental=feature = nix-command flakes
''; '';
programs.neovim = { programs.neovim = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;
}; };
programs.git.enable = true; programs.git.enable = true;
environment.systemPackages = [ environment.systemPackages = [
pkgs.gnumake pkgs.gnumake
pkgs.wget pkgs.wget
@ -25,6 +22,6 @@
]; ];
users.users.root = { users.users.root = {
# openssh runs in root, no? This is because port < 1024 requires root. # openssh runs in root, no? This is because port < 1024 requires root.
openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile "${proj_root.configs.path}/ssh/authorized_keys"); openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile "${proj_root}/ssh/authorized_keys");
}; };
} }

View File

@ -1,9 +1,8 @@
{ pkgs {pkgs
, lib ,lib
, config ,config
, ...
}: { }: {
environment.systemPackages = [ pkgs.mosh ]; environment.systemPackages = [pkgs.mosh];
networking.firewall = lib.mkIf config.networking.firewall.enable { networking.firewall = lib.mkIf config.networking.firewall.enable {
allowedUDPPortRanges = [ allowedUDPPortRanges = [
{ from = 60000; to = 61000; } # mosh { from = 60000; to = 61000; } # mosh

View File

@ -1,7 +0,0 @@
{ config, ... }: {
imports = [ ./gpu.sys.nix ];
nixpkgs.config.allowUnfree = true;
services.xserver.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
}

View File

@ -1,21 +0,0 @@
{ config, pkgs, lib }:
let
gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ];
gpu_conf = {
# openCL
hardware.opengl = {
enable = true;
extraPackages =
let
inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime;
in
[ rocm-opencl-icd rocm-opencl-runtime ];
# Vulkan
driSupport = true;
driSupport32Bit = true;
package = pkgs.mesa.drivers;
package32 = pkgs.pkgsi686Linux.mesa.drivers;
};
};
in
;

View File

@ -1,6 +1,8 @@
{ proj_root {agenix
, ... ,proj_root}: {
}: { imports = [
agenix.nixosModule
];
age.secrets.s3fs = { age.secrets.s3fs = {
file = "${proj_root.secrets.path}/s3fs.age"; file = "${proj_root.secrets.path}/s3fs.age";
# mode = "600"; # owner + group only # mode = "600"; # owner + group only
@ -13,8 +15,5 @@
age.secrets._nhitrl_cred = { age.secrets._nhitrl_cred = {
file = "${proj_root.secrets.path}/_nhitrl.age"; file = "${proj_root.secrets.path}/_nhitrl.age";
}; };
age.secrets."wifi.env" = { environment.systemPackages = [agenix.defaultPackage.x86_64-linux];
file = "${proj_root.secrets.path}/wifi.env.age";
};
# environment.systemPackages = [agenix.defaultPackage.x86_64-linux];
} }

View File

@ -1,6 +1,6 @@
{ {
services.openssh = { services.openssh = {
enable = true; enable = true;
permitRootLogin = "no"; permitRootLogin = false;
}; };
} }

View File

@ -1,5 +1,5 @@
# Personal configuration on storage solution # Personal configuration on storage solution
{ pkgs, config, lib, ... }: { { pkgs, config, lib }: {
environment.systemPackages = [ environment.systemPackages = [
pkgs.s3fs pkgs.s3fs
pkgs.cifs-utils pkgs.cifs-utils
@ -70,32 +70,28 @@
bucket = "digital-garden"; bucket = "digital-garden";
}) })
( (
let let args = {
args = { "-fstype" = "cifs";
"-fstype" = "cifs"; credentials = config.age.secrets._nhitrl_cred.path;
credentials = config.age.secrets._nhitrl_cred.path; user = null;
user = null; uid = "1001";
uid = "1001"; gid = "100";
gid = "100"; dir_mode = "0777";
dir_mode = "0777"; file_mode = "0777";
file_mode = "0777"; };
}; in "felia_d ${confToBackendArg args} ://felia.coati-celsius.ts.net/d"
in
"felia_d ${confToBackendArg args} ://felia.coati-celsius.ts.net/d"
) )
( (
let let args = {
args = { "-fstype" = "cifs";
"-fstype" = "cifs"; credentials = config.age.secrets._nhitrl_cred.path;
credentials = config.age.secrets._nhitrl_cred.path; user = null;
user = null; uid = "1001";
uid = "1001"; gid = "100";
gid = "100"; dir_mode = "0777";
dir_mode = "0777"; file_mode = "0777";
file_mode = "0777"; };
}; in "felia_f ${confToBackendArg args} ://felia.coati-celsius.ts.net/f"
in
"felia_f ${confToBackendArg args} ://felia.coati-celsius.ts.net/f"
) )
]; ];
persoConf = pkgs.writeText "auto.personal" (builtins.concatStringsSep "\n" personalStorage); persoConf = pkgs.writeText "auto.personal" (builtins.concatStringsSep "\n" personalStorage);

View File

@ -1,9 +1,8 @@
{ pkgs {pkgs
, config ,config
, lib ,lib
, ... ,...}: {
}: { environment.systemPackages = [pkgs.tailscale];
environment.systemPackages = [ pkgs.tailscale ];
services.tailscale.enable = true; services.tailscale.enable = true;
systemd.services.tailscale-autoconnect = { systemd.services.tailscale-autoconnect = {

View File

@ -1,8 +0,0 @@
{ config, ... }: {
networking.wireless.enable = true;
networking.wireless.environmentFile = config.age.secrets."wifi.env";
networking.wireless.networks = {
"Hoang Sa".psk = "@DESERT_PSK@";
"Truong Sa".psk = "@DESERT_PSK@";
};
}

View File

@ -20,37 +20,19 @@ if empty(glob(plug_path))
endif endif
]]) ]])
local function truthy(v) return v ~= nil end
local function cfg(cfg_var, do_fn) if truthy(cfg_var) then do_fn() end end
local function cfg_render(do_fn)
local should_render = not truthy(os.getenv("NVIM_HEADLESS"))
cfg(should_render, do_fn)
end
-- vim-plug -- vim-plug
local Plug = vim.fn['plug#'] local Plug = vim.fn['plug#']
vim.call('plug#begin') vim.call('plug#begin')
-- libs and dependencies -- libs and dependencies
Plug('nvim-lua/plenary.nvim') -- The base of all plugins Plug('nvim-lua/plenary.nvim')
-- plugins -- plugins
Plug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua Plug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua
Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting
Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects
Plug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser Plug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser
-- TODO: this might need to be taken extra care in our Nix config
-- What this Plug declaration means is this repo needs to be built on our running environment
-- -----
-- What to do:
-- - Run `make` at anytime before Nix is done on this repository
-- - Might mean that we fetch this repository, run make, and copy to destination folder
-- - Make sure that if we run `make` at first Plug run, that `make` is idempotent
-- OR
-- Make sure that Plug does not run `make` and use the output it needs
Plug('nvim-telescope/telescope-fzf-native.nvim', Plug('nvim-telescope/telescope-fzf-native.nvim',
{ ['do'] = 'make >> /tmp/log 2>&1' }) { ['do'] = 'make >> /tmp/log 2>&1' })
Plug('nvim-telescope/telescope-file-browser.nvim') Plug('nvim-telescope/telescope-file-browser.nvim')
@ -85,17 +67,15 @@ Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs)
Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*)
Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis
Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration
Plug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts
-- UI & colorscheme -- UI & colorscheme
cfg_render(function() Plug('gruvbox-community/gruvbox') -- theme provider
Plug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts Plug('nvim-lualine/lualine.nvim') -- fancy status line
Plug('gruvbox-community/gruvbox') -- theme provider Plug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines
Plug('nvim-lualine/lualine.nvim') -- fancy status line Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes
Plug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines Plug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog
Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes Plug('folke/todo-comments.nvim') -- Highlights TODO
Plug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog
Plug('folke/todo-comments.nvim') -- Highlights TODO
end)
-- other utilities -- other utilities
Plug('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) Plug('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
@ -104,11 +84,6 @@ Plug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, m
Plug('saadparwaiz1/cmp_luasnip') -- snippet engine Plug('saadparwaiz1/cmp_luasnip') -- snippet engine
Plug('L3MON4D3/LuaSnip') -- snippet engine Plug('L3MON4D3/LuaSnip') -- snippet engine
Plug('mickael-menu/zk-nvim') -- Zettelkasten Plug('mickael-menu/zk-nvim') -- Zettelkasten
-- Switch cases:
-- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust)
-- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case
-- `gs.` -> dot.case (R)
Plug('arthurxavierx/vim-caser') -- switch cases
--------- ---------
vim.call('plug#end') vim.call('plug#end')
@ -120,13 +95,12 @@ endif
]]) ]])
-- special terminals, place them at 4..=7 for ergonomics -- special terminals, place them at 4..=7 for ergonomics
vim.api.nvim_create_autocmd({ "VimEnter" }, { vim.api.nvim_create_autocmd({"VimEnter"}, {
callback = function() callback = function()
local function named_term(term_idx, term_name) local function named_term(term_idx, term_name)
require('harpoon.term').gotoTerminal(term_idx) require('harpoon.term').gotoTerminal(term_idx)
vim.cmd([[:exe ":file ]] .. term_name .. [[" | :bfirst]]) vim.cmd([[:exe ":file ]]..term_name..[[" | :bfirst]])
end end
-- term:ctl at 4 -- term:ctl at 4
named_term(4, "term:ctl") named_term(4, "term:ctl")
-- term:dev at 5 -- term:dev at 5
@ -180,7 +154,7 @@ vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- that does not collide with vi-motion keybind. This is because -- that does not collide with vi-motion keybind. This is because
-- <Alt-x> -> ^[x; while <Esc> on the terminal is ^[ -- <Alt-x> -> ^[x; while <Esc> on the terminal is ^[
vim.keymap.set('t', '<Esc>', '<C-\\><C-n>)') vim.keymap.set('t', '<Esc>', '<C-\\><C-n>)')
vim.keymap.set({ 'n', 'i', 'v' }, '<c-l>', '<Cmd>mode<Cr>', { desc = "" }) -- redraw on every mode vim.keymap.set({ 'n', 'i', 'v' }, '<c-l>', '<Cmd>mode<Cr>', {desc = ""}) -- redraw on every mode
-- diagnostics (errors/warnings to be shown) -- diagnostics (errors/warnings to be shown)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)

View File

@ -1,12 +1,12 @@
{ {
mkModuleArgs = import ./mkModuleArgs.nix; mkModuleArgs = import ./mkModuleArgs.nix;
modules = [ modules = [
./alacritty.nix ./alacritty.nix
./git.nix ./git.nix
./ssh.nix ./ssh.nix
./shells.nix ./shells.nix
{ {
config.programs.home-manager.enable = true; config.programs.home-manager.enable = true;
} }
]; ];
} }

View File

@ -66,9 +66,9 @@ in
example = 3000; example = 3000;
}; };
}; };
# TODO : anyway to override configuration? # TODO : anyway to override configuration?
config.programs.git = { config.programs.git = {
inherit (cfg) enable ignores; inherit (cfg) enable ignores;
userName = cfg.name; userName = cfg.name;
userEmail = cfg.email; userEmail = cfg.email;
aliases = baseAliases // cfg.aliases; aliases = baseAliases // cfg.aliases;

View File

@ -1,7 +1,7 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
let let
cfg = config.base.graphics; cfg = config.base.graphics;
cfgEnable = cfg.enable or (cfg.useNixGL.defaultPackage != null); cfgEnable = cfg.enable or cfg.useNixGLPackage != null;
types = lib.types; types = lib.types;
in in
{ {
@ -11,7 +11,7 @@ in
_enable = lib.mkOption { _enable = lib.mkOption {
type = types.bool; type = types.bool;
description = "Whether the graphics is implicitly enabled (final)"; description = "Whether the graphics is implicitly enabled (final)";
# internal = true; internal = true;
default = false; default = false;
}; };
useNixGL = { useNixGL = {
@ -35,7 +35,7 @@ in
# they will also need to do `config.base.shells.enable` # they will also need to do `config.base.shells.enable`
# generally, we want the behavior: import means enable # generally, we want the behavior: import means enable
config = lib.mkIf cfgEnable { config = lib.mkIf cfgEnable {
base.graphics._enable = lib.mkForce true; base.graphics._enable = cfgEnable;
base.shells = { base.shells = {
shellAliases = lib.mkIf (cfg.useNixGL.defaultPackage != null) { shellAliases = lib.mkIf (cfg.useNixGL.defaultPackage != null) {
nixGL = cfg.useNixGL.defaultPackage; nixGL = cfg.useNixGL.defaultPackage;

View File

@ -22,8 +22,8 @@ in
keyfile_path = lib.mkOption { keyfile_path = lib.mkOption {
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
description = '' description = ''
Path to key file for the database Path to key file for the database
If null, then the field is unset If null, then the field is unset
''; '';
default = null; default = null;
example = "/path/to/mykeyfile.key"; example = "/path/to/mykeyfile.key";
@ -47,7 +47,7 @@ in
] ++ (if cfg.use_gui or config.base.graphics._enable then [ ] ++ (if cfg.use_gui or config.base.graphics._enable then [
pkgs.keepass # Personal secret management pkgs.keepass # Personal secret management
] else [ ]); ] else [ ]);
home.file.".kp/config.ini".text = lib.generators.toINI { } (trimNull { home.file.".kp/config.ini".text = lib.generators.toINI {} (trimNull {
default = { default = {
KEEPASSDB = cfg.path; KEEPASSDB = cfg.path;
KEEPASSDB_KEYFILE = cfg.keyfile_path; KEEPASSDB_KEYFILE = cfg.keyfile_path;

View File

@ -1,5 +1,3 @@
# Turns given inputs into the standardized shape of the inputs to configure
# custom base modules in this directory.
{ pkgs { pkgs
, lib ? pkgs.lib , lib ? pkgs.lib
, ... , ...

View File

@ -1,5 +1,3 @@
# TODO: maybe throw if base.graphics is not enabled?
# Though, headless chromium might be possible
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let cfg = config.base.private_chromium; let cfg = config.base.private_chromium;
in in

View File

@ -1,11 +1,8 @@
# A module that takes care of a GUI-ful, productive desktop environment inputs@{pkgs,...}: {
inputs@{ pkgs, ... }: {
imports = [ imports = [
# slack # slack
({ pkgs, ... }: { ({pkgs,...}: {
home.packages = [ home.packages = [pkgs.slack];
pkgs.slack
];
}) })
./private_chromium.nix ./private_chromium.nix
]; ];

View File

@ -83,12 +83,12 @@ in
oh-my-zsh = { oh-my-zsh = {
enable = true; enable = true;
plugins = [ plugins = [
"git" # git command aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git#aliases "git" # git command aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git#aliases
# "sudo" # double-escape to prepend sudo # UPDATE: just use vi-mode lol # "sudo" # double-escape to prepend sudo # UPDATE: just use vi-mode lol
"command-not-found" # suggests which package to install; does not support nixos (we have solution already) "command-not-found" # suggests which package to install; does not support nixos (we have solution already)
"gitignore" # `gi list` -> `gi java >>.gitignore` "gitignore" # `gi list` -> `gi java >>.gitignore`
"ripgrep" # adds completion for `rg` "ripgrep" # adds completion for `rg`
"rust" # compe for rustc/cargo "rust" # compe for rustc/cargo
# "vi-mode" # edit promps with vi motions :) # "vi-mode" # edit promps with vi motions :)
]; ];
}; };
@ -96,9 +96,9 @@ in
# VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true; # VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true;
# VI_MODE_SET_CURSOR = true; # VI_MODE_SET_CURSOR = true;
# ZVM_VI_ESCAPE_BINDKEY = ""; # ZVM_VI_ESCAPE_BINDKEY = "";
ZVM_READKEY_ENGINE = "$ZVM_READKEY_ENGINE_NEX"; ZVM_READKEY_ENGINE="$ZVM_READKEY_ENGINE_NEX";
ZVM_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) ZVM_KEYTIMEOUT=0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :)
ZVM_ESCAPE_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) ZVM_ESCAPE_KEYTIMEOUT=0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :)
}; };
initExtra = (cfg.shellInitExtra or "") + '' initExtra = (cfg.shellInitExtra or "") + ''
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh

View File

@ -1,7 +1,7 @@
{ config { config
, proj_root , proj_root
, myLib , myLib
, ... , ...
}: }:
let cfg = config.base.ssh; let cfg = config.base.ssh;
in in

View File

@ -16,22 +16,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1668681692,
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1667395993,
@ -49,11 +33,11 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1659877975,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -77,21 +61,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_4": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -100,11 +69,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1673343300, "lastModified": 1672770368,
"narHash": "sha256-5Xdj6kpXYMie0MlnGwqK5FaMdsedxvyuakWtyKB3zaQ=", "narHash": "sha256-iO6Z9blIe8dcPh3VT2nkej9EimORCoskGQR6xNjICWI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "176e455371a8371586e8a3ff0d56ee9f3ca2324e", "rev": "d01e7280ad7d13a5a0fae57355bd0dbfe5b81969",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -129,58 +98,14 @@
"type": "github" "type": "github"
} }
}, },
"neovim-flake": { "nixgl": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
]
},
"locked": {
"dir": "contrib",
"lastModified": 1673504032,
"narHash": "sha256-x4nv7g8+bQXg5PfkFw3vCcr3pYI0Hco0VoSbAy60xek=",
"owner": "neovim",
"repo": "neovim",
"rev": "143d3f1f3224bca02bfef7df0932b9d7524a3ff2",
"type": "github"
},
"original": {
"dir": "contrib",
"owner": "neovim",
"repo": "neovim",
"type": "github"
}
},
"neovim-nightly-overlay": {
"inputs": {
"flake-compat": "flake-compat_2",
"neovim-flake": "neovim-flake",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": {
"lastModified": 1673511313,
"narHash": "sha256-QGUT3w1bHclVRqX958EPOd3OxR/R10MoV97N5jx/qbw=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "5af6fe31f9906e70a1e8985dbbdcc4ae66c7f82d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"type": "github"
}
},
"nixgl": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_2"
},
"locked": { "locked": {
"lastModified": 1, "lastModified": 1,
"narHash": "sha256-GgIXbuHvwReBHZUyfSKS6DET3CfD6EEKABj6ndpcqHQ=", "narHash": "sha256-KP+2qdZlhmRkrafuuEofg7YnNdVmGV95ipvpuqmJneI=",
"path": "./../../out-of-tree/nixGL", "path": "./../../out-of-tree/nixGL",
"type": "path" "type": "path"
}, },
@ -190,22 +115,6 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1671983799,
"narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1660551188, "lastModified": 1660551188,
"narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=",
@ -220,13 +129,13 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1673450908, "lastModified": 1672617983,
"narHash": "sha256-b8em+kwrNtnB7gR8SyVf6WuTyQ+6tHS6dzt9D9wgKF0=", "narHash": "sha256-68WDiCBs631mbDDk4UAKdGURKcsfW6hjb7wgudTAe5o=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6c8644fc37b6e141cbfa6c7dc8d98846c4ff0c2e", "rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -236,7 +145,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1665296151, "lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
@ -258,23 +167,22 @@
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager",
"kpcli-py": "kpcli-py", "kpcli-py": "kpcli-py",
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nixgl": "nixgl", "nixgl": "nixgl",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_2",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1673490397, "lastModified": 1672712534,
"narHash": "sha256-VCSmIYJy/ZzTvEGjdfITmTYfybXBgZpMjyjDndbou+8=", "narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "0833f4d063a2bb75aa31680f703ba594a384ffe6", "rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -18,15 +18,6 @@
url = "github:rebkwok/kpcli"; url = "github:rebkwok/kpcli";
flake = false; flake = false;
}; };
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
# Pin to a nixpkgs revision that doesn't have NixOS/nixpkgs#208103 yet
inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836";
};
nix-index-database = {
url = "github:mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
@ -36,22 +27,10 @@
, rust-overlay , rust-overlay
, flake-utils , flake-utils
, kpcli-py , kpcli-py
, neovim-nightly-overlay
, ... , ...
}: }:
let let
# config_fn:: system -> config system = "x86_64-linux";
cross_platform = config_fn: ({
packages = builtins.foldl'
(prev: system: prev // {
"${system}" = config_fn system;
})
{ }
flake-utils.lib.defaultSystems;
});
in
cross_platform (system:
let
overlays = import ./../../overlays.nix flake_inputs; overlays = import ./../../overlays.nix flake_inputs;
# pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays; # pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays;
pkgs = import nixpkgs { pkgs = import nixpkgs {
@ -61,11 +40,11 @@
# lib = (import ../lib { inherit pkgs; lib = pkgs.lib; }); # lib = (import ../lib { inherit pkgs; lib = pkgs.lib; });
base = import ./base; base = import ./base;
inherit (base) mkModuleArgs; inherit (base) mkModuleArgs;
kde_module = { config, pkgs, ... }: { kde_module = {config, pkgs, ...}: {
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
home.packages = [ home.packages = [
(pkgs.nerdfonts.override { fonts = [ "DroidSansMono" ]; }) (pkgs.nerdfonts.override {fonts = ["DroidSansMono"];})
]; ];
# For some reasons, Windows es in the font name as DroidSansMono NF # For some reasons, Windows es in the font name as DroidSansMono NF
# so we need to override this # so we need to override this
@ -77,14 +56,13 @@
inherit overlays pkgs base; inherit overlays pkgs base;
}; };
homeConfigurations = homeConfigurations =
let let x11_wsl = ''
x11_wsl = '' # x11 output for WSL
# x11 output for WSL export DISPLAY=$(ip route list default | awk '{print $3}'):0
export DISPLAY=$(ip route list default | awk '{print $3}'):0 export LIBGL_ALWAYS_INDIRECT=1
export LIBGL_ALWAYS_INDIRECT=1 '';
'';
in in
{ rec {
"hungtr" = home-manager.lib.homeManagerConfiguration { "hungtr" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = base.modules ++ [ modules = base.modules ++ [
@ -107,14 +85,6 @@
./home.nix ./home.nix
kde_module kde_module
./base/productive_desktop.nix ./base/productive_desktop.nix
{
# since home.nix forces us to use keepass, and base.keepass.path
# defaults to a bad value (on purpose), we should configure a
# it to be the proper path
base.keepass.path = "/perso/garden/keepass.kdbx";
base.graphics.useNixGL.defaultPackage = "nixGLNvidia";
base.graphics.useNixGL.enable = true;
}
]; ];
# optionally pass inarguments to module # optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility # we migrate this from in-place modules to allow flexibility
@ -127,25 +97,6 @@
}; };
}; };
}; };
"htran" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
{
base.graphics.enable = false;
base.graphics.useNixGL.defaultPackage = null;
base.keepass.path = "/Users/htran/keepass.kdbx";
# don't want to deal with GL stuffs on mac yet :/
}
];
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
myHome = {
username = "htran";
homeDirectory = "/Users/htran";
};
};
};
"nixos@Felia" = home-manager.lib.homeManagerConfiguration { "nixos@Felia" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
@ -196,9 +147,8 @@
base.alacritty.font.family = "BitstreamVeraSansMono Nerd Font"; base.alacritty.font.family = "BitstreamVeraSansMono Nerd Font";
base.keepass.path = "/media/homelab/f/PersistentHotStorage/keepass.kdbx"; base.keepass.path = "/media/homelab/f/PersistentHotStorage/keepass.kdbx";
} }
./base/productive_desktop.nix
]; ];
extraSpecialArgs = mkModuleArgs { extraSpecialArgs = mkModuleArgs {
inherit pkgs; inherit pkgs;
myHome = { myHome = {
@ -211,5 +161,5 @@
}; };
}; };
}; };
}); };
} }

View File

@ -1,111 +1,109 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
from-yaml = { from-yaml ={
url = "github:pegasust/fromYaml"; url = "github:pegasust/fromYaml";
flake = false; flake = false;
}; };
}; };
outputs = { nixpkgs, from-yaml, ... }: outputs = {nixpkgs,from-yaml, ...}: let
let system = "x86_64-linux";
system = "x86_64-linux"; pkgs = import nixpkgs {inherit system;};
pkgs = import nixpkgs { inherit system; }; lib = {
lib = { fromYaml = import "${from-yaml}/fromYaml.nix" {lib = pkgs.lib;};
fromYaml = import "${from-yaml}/fromYaml.nix" { lib = pkgs.lib; };
};
in
{
inherit nixpkgs;
inherit from-yaml;
inherit lib;
inherit pkgs;
fromYamlFn = lib.fromYaml;
yamlCmd = str: (builtins.fromJSON (pkgs.runCommand "echo ${str} | yq"));
test_0 = ''
key_bindings:
- hello:
"N"
'';
key_bind = ''
key_bindings:
- { key: N, mods: Control, action: CreateNewWindow }
# - { key: Paste, action: Paste }
# - { key: Copy, action: Copy }
#- { key: L, mods: Control, action: ClearLogNotice }
#- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" }
#- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp }
#- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown }
#- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop }
#- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom }
# Vi Mode
#- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode }
- { key: Escape, mods: Shift, mode: ~Search, action: ToggleViMode }
#- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
#- { key: Escape, mode: Vi|~Search, action: ClearSelection }
#- { key: I, mode: Vi|~Search, action: ToggleViMode }
#- { key: I, mode: Vi|~Search, action: ScrollToBottom }
#- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode }
#- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp }
#- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown }
#- { key: G, mode: Vi|~Search, action: ScrollToTop }
#- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom }
#- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp }
#- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown }
#- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp }
#- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown }
#- { key: Y, mode: Vi|~Search, action: Copy }
#- { key: Y, mode: Vi|~Search, action: ClearSelection }
#- { key: Copy, mode: Vi|~Search, action: ClearSelection }
#- { key: V, mode: Vi|~Search, action: ToggleNormalSelection }
#- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection }
#- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection }
#- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection }
#- { key: Return, mode: Vi|~Search, action: Open }
#- { key: Z, mode: Vi|~Search, action: CenterAroundViCursor }
#- { key: K, mode: Vi|~Search, action: Up }
#- { key: J, mode: Vi|~Search, action: Down }
#- { key: H, mode: Vi|~Search, action: Left }
#- { key: L, mode: Vi|~Search, action: Right }
#- { key: Up, mode: Vi|~Search, action: Up }
#- { key: Down, mode: Vi|~Search, action: Down }
#- { key: Left, mode: Vi|~Search, action: Left }
#- { key: Right, mode: Vi|~Search, action: Right }
#- { key: Key0, mode: Vi|~Search, action: First }
#- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last }
#- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied }
#- { key: H, mods: Shift, mode: Vi|~Search, action: High }
#- { key: M, mods: Shift, mode: Vi|~Search, action: Middle }
#- { key: L, mods: Shift, mode: Vi|~Search, action: Low }
#- { key: B, mode: Vi|~Search, action: SemanticLeft }
#- { key: W, mode: Vi|~Search, action: SemanticRight }
#- { key: E, mode: Vi|~Search, action: SemanticRightEnd }
#- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft }
#- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight }
#- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd }
#- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket }
#- { key: Slash, mode: Vi|~Search, action: SearchForward }
#- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward }
#- { key: N, mode: Vi|~Search, action: SearchNext }
#- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious }
# Search Mode
#- { key: Return, mode: Search|Vi, action: SearchConfirm }
#- { key: Escape, mode: Search, action: SearchCancel }
#- { key: C, mods: Control, mode: Search, action: SearchCancel }
#- { key: U, mods: Control, mode: Search, action: SearchClear }
#- { key: W, mods: Control, mode: Search, action: SearchDeleteWord }
#- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious }
#- { key: N, mods: Control, mode: Search, action: SearchHistoryNext }
#- { key: Up, mode: Search, action: SearchHistoryPrevious }
#- { key: Down, mode: Search, action: SearchHistoryNext }
#- { key: Return, mode: Search|~Vi, action: SearchFocusNext }
#- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious }
# (Windows, Linux, and BSD only)
- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste }
- { key: C, mods: Control|Shift, action: Copy }
'';
}; };
in {
inherit nixpkgs;
inherit from-yaml;
inherit lib;
inherit pkgs;
fromYamlFn = lib.fromYaml;
yamlCmd = str: (builtins.fromJSON(pkgs.runCommand "echo ${str} | yq"));
test_0 = ''
key_bindings:
- hello:
"N"
'';
key_bind = ''
key_bindings:
- { key: N, mods: Control, action: CreateNewWindow }
# - { key: Paste, action: Paste }
# - { key: Copy, action: Copy }
#- { key: L, mods: Control, action: ClearLogNotice }
#- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" }
#- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp }
#- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown }
#- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop }
#- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom }
# Vi Mode
#- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode }
- { key: Escape, mods: Shift, mode: ~Search, action: ToggleViMode }
#- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
#- { key: Escape, mode: Vi|~Search, action: ClearSelection }
#- { key: I, mode: Vi|~Search, action: ToggleViMode }
#- { key: I, mode: Vi|~Search, action: ScrollToBottom }
#- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode }
#- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp }
#- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown }
#- { key: G, mode: Vi|~Search, action: ScrollToTop }
#- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom }
#- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp }
#- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown }
#- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp }
#- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown }
#- { key: Y, mode: Vi|~Search, action: Copy }
#- { key: Y, mode: Vi|~Search, action: ClearSelection }
#- { key: Copy, mode: Vi|~Search, action: ClearSelection }
#- { key: V, mode: Vi|~Search, action: ToggleNormalSelection }
#- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection }
#- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection }
#- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection }
#- { key: Return, mode: Vi|~Search, action: Open }
#- { key: Z, mode: Vi|~Search, action: CenterAroundViCursor }
#- { key: K, mode: Vi|~Search, action: Up }
#- { key: J, mode: Vi|~Search, action: Down }
#- { key: H, mode: Vi|~Search, action: Left }
#- { key: L, mode: Vi|~Search, action: Right }
#- { key: Up, mode: Vi|~Search, action: Up }
#- { key: Down, mode: Vi|~Search, action: Down }
#- { key: Left, mode: Vi|~Search, action: Left }
#- { key: Right, mode: Vi|~Search, action: Right }
#- { key: Key0, mode: Vi|~Search, action: First }
#- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last }
#- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied }
#- { key: H, mods: Shift, mode: Vi|~Search, action: High }
#- { key: M, mods: Shift, mode: Vi|~Search, action: Middle }
#- { key: L, mods: Shift, mode: Vi|~Search, action: Low }
#- { key: B, mode: Vi|~Search, action: SemanticLeft }
#- { key: W, mode: Vi|~Search, action: SemanticRight }
#- { key: E, mode: Vi|~Search, action: SemanticRightEnd }
#- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft }
#- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight }
#- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd }
#- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket }
#- { key: Slash, mode: Vi|~Search, action: SearchForward }
#- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward }
#- { key: N, mode: Vi|~Search, action: SearchNext }
#- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious }
# Search Mode
#- { key: Return, mode: Search|Vi, action: SearchConfirm }
#- { key: Escape, mode: Search, action: SearchCancel }
#- { key: C, mods: Control, mode: Search, action: SearchCancel }
#- { key: U, mods: Control, mode: Search, action: SearchClear }
#- { key: W, mods: Control, mode: Search, action: SearchDeleteWord }
#- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious }
#- { key: N, mods: Control, mode: Search, action: SearchHistoryNext }
#- { key: Up, mode: Search, action: SearchHistoryPrevious }
#- { key: Down, mode: Search, action: SearchHistoryNext }
#- { key: Return, mode: Search|~Vi, action: SearchFocusNext }
#- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious }
# (Windows, Linux, and BSD only)
- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste }
- { key: C, mods: Control|Shift, action: Copy }
'';
};
} }

View File

@ -26,16 +26,16 @@ in
}; };
home.packages = pkgs.lib.unique ([ home.packages = pkgs.lib.unique ([
# pkgs.ncdu # pkgs.ncdu
pkgs.rclone # cloud file operations pkgs.rclone # cloud file operations
pkgs.htop # system diagnostics in CLI pkgs.htop # system diagnostics in CLI
pkgs.ripgrep # content fuzzy search pkgs.ripgrep # content fuzzy search
pkgs.unzip # compression pkgs.unzip # compression
pkgs.zip # compression pkgs.zip # compression
# cool utilities # cool utilities
pkgs.yq # Yaml adaptor for jq (only pretty print, little query) pkgs.yq # Yaml adaptor for jq (only pretty print, little query)
# pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation
# pkgs.logseq # TODO: only include if have GL # Obsidian alt pkgs.logseq # TODO: only include if have GL # Obsidian alt
pkgs.mosh # Parsec for SSH pkgs.mosh # Parsec for SSH
# pkgs.nixops_unstable # nixops v2 # insecure for now # pkgs.nixops_unstable # nixops v2 # insecure for now
pkgs.lynx # Web browser at your local terminal pkgs.lynx # Web browser at your local terminal
@ -46,9 +46,7 @@ in
# pkgs.python310.numpy # pkgs.python310.numpy
# pkgs.python310Packages.tensorflow # pkgs.python310Packages.tensorflow
# pkgs.python310Packages.scikit-learn # pkgs.python310Packages.scikit-learn
] ++ (myHome.packages or [ ]) ++ (if pkgs.system == "x86_64-linux" then [ ] ++ (myHome.packages or [ ])
pkgs.logseq
] else [ ])
); );
## Configs ## ## Configs ##

View File

@ -1,5 +1,5 @@
# main module exporter for different configuration profiles # main module exporter for different configuration profiles
{ pkgs, libs, ... } @ inputs: {pkgs, libs,...} @ inputs:
{ {
hwtr = import ./hwtr.nix; hwtr = import ./hwtr.nix;
} }

View File

@ -1 +0,0 @@

View File

@ -1,10 +1,8 @@
{ pkgs { pkgs
, lib ? pkgs.lib , lib ? pkgs.lib
, ... , ... }@flake_import:
}@flake_import: let serde = import ./serde { inherit pkgs lib; };
let recursiveUpdate = lib.recursiveUpdate;
serde = import ./serde { inherit pkgs lib; };
recursiveUpdate = lib.recursiveUpdate;
in in
recursiveUpdate (recursiveUpdate pkgs.lib lib) { recursiveUpdate (recursiveUpdate pkgs.lib lib) {
fromYaml = serde.fromYaml; fromYaml = serde.fromYaml;

View File

@ -4,7 +4,7 @@
{ pkgs { pkgs
, lib , lib
} @ inputs: } @ inputs:
let let
yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage
({ runCommand }: ({ runCommand }:
# runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33 # runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33
@ -15,16 +15,14 @@ let
echo "$yamlContent" | yq >$out echo "$yamlContent" | yq >$out
'') '')
{ }; { };
in in {
{
# Takes in a yaml string and produces a derivation with translated JSON at $outputPath # Takes in a yaml string and produces a derivation with translated JSON at $outputPath
# similar to builtins.fromJSON, turns a YAML string to nix attrset # similar to builtins.fromJSON, turns a YAML string to nix attrset
fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json")); fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json"));
fromYamlPath = yamlPath: builtins.fromJSON ( fromYamlPath = yamlPath: builtins.fromJSON (
builtins.readFile ( builtins.readFile (
yamlToJsonDrv yamlToJsonDrv (
( builtins.readFile yamlPath)
builtins.readFile yamlPath) "any-output.json"));
"any-output.json"));
# TODO: fromToml? # TODO: fromToml?
} }

View File

@ -1,4 +1,4 @@
let let
# user-specific (~/.ssh/id_ed25519.pub) # user-specific (~/.ssh/id_ed25519.pub)
users = { users = {
"hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; "hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z";
@ -10,8 +10,7 @@ let
all = users // systems; all = users // systems;
# stands for calculus # stands for calculus
c_ = builtins; c_ = builtins;
in in {
{
"system/secrets/s3fs.age".publicKeys = c_.attrValues (all); "system/secrets/s3fs.age".publicKeys = c_.attrValues (all);
"system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all); "system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all);
"system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all); "system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all);

View File

@ -29,7 +29,7 @@ with lib;
isNormalUser = true; isNormalUser = true;
home = "/home/hungtr"; home = "/home/hungtr";
description = "pegasust/hungtr"; description = "pegasust/hungtr";
extraGroups = [ "wheel" "networkmanager" "audio" ]; extraGroups = [ "wheel" "networkmanager" "audio"];
}; };
users.users.root = { users.users.root = {
# openssh runs in root, no? This is because port < 1024 requires root. # openssh runs in root, no? This is because port < 1024 requires root.

View File

@ -8,8 +8,8 @@
}; };
outputs = { self, nixpkgs, agenix, ... }: outputs = { self, nixpkgs, agenix, ... }:
let let
lib = nixpkgs.lib; lib = nixpkgs.lib;
proj_root = ./../..; proj_root = ./../..;
# TODO: Change respectively to the system or make a nix shell to alias `nix run github:ryantm/agenix -- ` # TODO: Change respectively to the system or make a nix shell to alias `nix run github:ryantm/agenix -- `
base_modules = [ base_modules = [
@ -27,11 +27,10 @@
age.secrets._nhitrl_cred = { age.secrets._nhitrl_cred = {
file = ./secrets/_nhitrl.age; file = ./secrets/_nhitrl.age;
}; };
environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ]; environment.systemPackages = [agenix.defaultPackage.x86_64-linux];
} }
]; ];
in in {
{
# Windows with NixOS WSL # Windows with NixOS WSL
nixosConfigurations.Felia = nixpkgs.lib.nixosSystem { nixosConfigurations.Felia = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
@ -207,165 +206,163 @@
}; };
nixosConfigurations.bao = nixpkgs.lib.nixosSystem { nixosConfigurations.bao = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs.hostname = "bao"; specialArgs.hostname = "bao";
modules = base_modules ++ [ modules = base_modules ++ [
./configuration.nix ./configuration.nix
./../../modules/storage.perso.sys.nix ./../../modules/storage.perso.sys.nix
# GPU, sound, networking stuffs # GPU, sound, networking stuffs
({ config, pkgs, lib, ... }: ({ config, pkgs, lib, ... }:
let let
gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ]; gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ];
gpu_conf = { gpu_conf = {
# openCL # openCL
hardware.opengl = { hardware.opengl = {
enable = true;
extraPackages =
let
inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime;
in
[ rocm-opencl-icd rocm-opencl-runtime ];
# Vulkan
driSupport = true;
driSupport32Bit = true;
package = pkgs.mesa.drivers;
package32 = pkgs.pkgsi686Linux.mesa.drivers;
};
};
amd_rx470 = {
# early amd gpu usage
boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.enable = true;
services.xserver.videoDrivers = [ "amdgpu" ];
};
nv_rtx3060 = {
nixpkgs.config.allowUnfree = true;
services.xserver.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
};
systemPackages = [ ] ++ gpu_pkgs;
in
lib.recursiveUpdate gpu_conf (lib.recursiveUpdate nv_rtx3060 {
# Use UEFI
boot.loader.systemd-boot.enable = true;
networking.hostName = "bao"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Enable the X11 windowing system.
services.xserver.enable = true;
# KDE & Plasma 5
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5 = {
enable = true; enable = true;
excludePackages = let plasma5 = pkgs.libsForQt5; in [ extraPackages = let
plasma5.elisa # audio viewer inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime;
plasma5.konsole # I use alacritty instaed in [rocm-opencl-icd rocm-opencl-runtime];
plasma5.plasma-browser-integration # Vulkan
plasma5.print-manager # will enable if I need driSupport = true;
plasma5.khelpcenter # why not just write manpages instead :( driSupport32Bit = true;
# plasma5.ksshaskpass # pls just put prompts on my dear terminal package = pkgs.mesa.drivers;
]; package32 = pkgs.pkgsi686Linux.mesa.drivers;
}; };
};
amd_rx470 = {
# early amd gpu usage
# boot.initrd.kernelModules = ["amdgpu"];
services.xserver.enable = true;
services.xserver.videoDrivers = ["amdgpu"];
};
nv_rtx3060 = {
nixpkgs.config.allowUnfree = true;
services.xserver.enable = true;
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
};
systemPackages = [] ++ gpu_pkgs;
in
lib.recursiveUpdate gpu_conf (lib.recursiveUpdate nv_rtx3060 {
# Use UEFI
boot.loader.systemd-boot.enable = true;
# disables KDE's setting of askpassword networking.hostName = "bao"; # Define your hostname.
programs.ssh.askPassword = ""; # Pick only one of the below networking options.
programs.ssh.enableAskPassword = false; # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
time.timeZone = "America/Phoenix"; # Enable the X11 windowing system.
# Configure keymap in X11 services.xserver.enable = true;
services.xserver.layout = "us"; # KDE & Plasma 5
# services.xserver.xkbOptions = { services.xserver.displayManager.sddm.enable = true;
# "eurosign:e"; services.xserver.desktopManager.plasma5 = {
# "caps:escape" # map caps to escape. enable = true;
# }; excludePackages = let plasma5 = pkgs.libsForQt5; in [
plasma5.elisa # audio viewer
plasma5.konsole # I use alacritty instaed
plasma5.plasma-browser-integration
plasma5.print-manager # will enable if I need
plasma5.khelpcenter # why not just write manpages instead :(
# plasma5.ksshaskpass # pls just put prompts on my dear terminal
];
};
# disables KDE's setting of askpassword
programs.ssh.askPassword = "";
programs.ssh.enableAskPassword = false;
# Enable CUPS to print documents. time.timeZone = "America/Phoenix";
# services.printing.enable = true; # Configure keymap in X11
services.xserver.layout = "us";
# services.xserver.xkbOptions = {
# "eurosign:e";
# "caps:escape" # map caps to escape.
# };
# Enable sound. (pulse audio) # Enable CUPS to print documents.
sound.enable = true; # services.printing.enable = true;
programs.dconf.enable = true;
hardware.pulseaudio.enable = true;
hardware.pulseaudio.support32Bit = true;
nixpkgs.config.pulseaudio = true;
hardware.pulseaudio.extraConfig = "load-module module-combine-sink";
# Sound: pipewire # Enable sound. (pulse audio)
# sound.enable = false; sound.enable = true;
# hardware.pulseaudio.enable = false; programs.dconf.enable = true;
# services.pipewire = { hardware.pulseaudio.enable = true;
# enable = true; hardware.pulseaudio.support32Bit = true;
# alsa.enable = true; nixpkgs.config.pulseaudio = true;
# alsa.support32Bit = true; hardware.pulseaudio.extraConfig = "load-module module-combine-sink";
# pulse.enable = true;
# # Might want to use JACK in the future # Sound: pipewire
# jack.enable = true; # sound.enable = false;
# }; # hardware.pulseaudio.enable = false;
# # services.pipewire = {
# security.rtkit.enable = true; # enable = true;
# alsa.enable = true;
# alsa.support32Bit = true;
# pulse.enable = true;
# # Might want to use JACK in the future
# jack.enable = true;
# };
#
# security.rtkit.enable = true;
# Enable touchpad support (enabled default in most desktopManager). # Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true; # services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
# users.users.alice = { # users.users.alice = {
# isNormalUser = true; # isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable sudo for the user. # extraGroups = [ "wheel" ]; # Enable sudo for the user.
# packages = with pkgs; [ # packages = with pkgs; [
# firefox # firefox
# thunderbird # thunderbird
# ]; # ];
# }; # };
# Just an initial user to get this started lol # Just an initial user to get this started lol
users.users.user = { users.users.user = {
initialPassword = "pw123"; initialPassword = "pw123";
extraGroups = [ "wheel" "networkmanager" "audio" ]; extraGroups = [ "wheel" "networkmanager" "audio"];
isNormalUser = true; isNormalUser = true;
}; };
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
neovim neovim
wget wget
] ++ systemPackages; ] ++ systemPackages;
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;
# programs.gnupg.agent = { # programs.gnupg.agent = {
# enable = true; # enable = true;
# enableSSHSupport = true; # enableSSHSupport = true;
# }; # };
# List services that you want to enable: # List services that you want to enable:
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh.enable = true; services.openssh.enable = true;
# Open ports in the firewall. # Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether. # Or disable the firewall altogether.
# networking.firewall.enable = false; # networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system # Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you # (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix. # accidentally delete configuration.nix.
# system.copySystemConfiguration = true; # system.copySystemConfiguration = true;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave # on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system. # this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option # Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment? system.stateVersion = "22.11"; # Did you read the comment?
})) }))
]; ];
}; };
}; };

View File

@ -5,8 +5,7 @@
{ {
imports = imports =
[ [ (modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
@ -24,13 +23,13 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ { device = "/dev/sda";
device = "/dev/sda";
fsType = "ext4"; fsType = "ext4";
}; };
swapDevices = swapDevices =
[{ device = "/dev/sdb"; }]; [ { device = "/dev/sdb"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@ -5,27 +5,24 @@
{ {
imports = imports =
[ [ (modulesPath + "/installer/scan/not-detected.nix")
(modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
# boot.initrd.kernelModules = [ "amdgpu" ]; # boot.initrd.kernelModules = [ "amdgpu" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-amd" "coretemp" ]; boot.kernelModules = [ "kvm-amd" "coretemp"];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
# Might be wise to use /dev/nvme0p1 instead # Might be wise to use /dev/nvme0p1 instead
{ { device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2";
device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" =
# Might be wise to use /dev/nvme0p2 instead # Might be wise to use /dev/nvme0p2 instead
{ { device = "/dev/disk/by-uuid/EBA6-394D";
device = "/dev/disk/by-uuid/EBA6-394D";
fsType = "vfat"; fsType = "vfat";
}; };

View File

@ -5,8 +5,7 @@
{ {
imports = imports =
[ [ (modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
@ -24,13 +23,13 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ { device = "/dev/sda";
device = "/dev/sda";
fsType = "ext4"; fsType = "ext4";
}; };
swapDevices = swapDevices =
[{ device = "/dev/sdb"; }]; [ { device = "/dev/sdb"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@ -5,8 +5,7 @@
{ {
imports = imports =
[ [ (modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
@ -14,7 +13,7 @@
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
boot.kernelParams = [ "console=ttyS0,19200n8" ]; boot.kernelParams = ["console=ttyS0,19200n8"];
boot.loader.grub.extraConfig = '' boot.loader.grub.extraConfig = ''
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
terminal_input serial; terminal_input serial;
@ -24,13 +23,13 @@
boot.loader.grub.device = "nodev"; boot.loader.grub.device = "nodev";
boot.loader.timeout = 10; boot.loader.timeout = 10;
fileSystems."/" = fileSystems."/" =
{ { device = "/dev/sda";
device = "/dev/sda";
fsType = "ext4"; fsType = "ext4";
}; };
swapDevices = swapDevices =
[{ device = "/dev/sdb"; }]; [ { device = "/dev/sdb"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@ -20,6 +20,6 @@ let
''; '';
}); });
in in
(with pure; [ nixGLIntel nixVulkanNvidia nixGLNvidia nixVulkanIntel ]) (with pure; [nixGLIntel nixVulkanNvidia nixGLNvidia nixVulkanIntel])
++ (with versionFile440.auto; [ nixGLNvidia nixGLDefault nixVulkanNvidia ]) ++ (with versionFile440.auto; [nixGLNvidia nixGLDefault nixVulkanNvidia])
++ (with versionFile510.auto; [ nixGLNvidia nixGLDefault nixVulkanNvidia ]) ++ (with versionFile510.auto; [nixGLNvidia nixGLDefault nixVulkanNvidia])

View File

@ -1,25 +1,24 @@
{ { ## Nvidia informations.
## Nvidia informations.
# Version of the system kernel module. Let it to null to enable auto-detection. # Version of the system kernel module. Let it to null to enable auto-detection.
nvidiaVersion ? null nvidiaVersion ? null,
, # Hash of the Nvidia driver .run file. null is fine, but fixing a value here # Hash of the Nvidia driver .run file. null is fine, but fixing a value here
# will be more reproducible and more efficient. # will be more reproducible and more efficient.
nvidiaHash ? null nvidiaHash ? null,
, # Alternatively, you can pass a path that points to a nvidia version file # Alternatively, you can pass a path that points to a nvidia version file
# and let nixGL extract the version from it. That file must be a copy of # and let nixGL extract the version from it. That file must be a copy of
# /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see # /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see
# https://github.com/NixOS/nix/issues/3539 ). # https://github.com/NixOS/nix/issues/3539 ).
nvidiaVersionFile ? null nvidiaVersionFile ? null,
, # Enable 32 bits driver # Enable 32 bits driver
# This is on by default, you can switch it to off if you want to reduce a # This is on by default, you can switch it to off if you want to reduce a
# bit the size of nixGL closure. # bit the size of nixGL closure.
enable32bits ? true enable32bits ? true,
, # Make sure to enable config.allowUnfree to the instance of nixpkgs to be # Make sure to enable config.allowUnfree to the instance of nixpkgs to be
# able to access the nvidia drivers. # able to access the nvidia drivers.
pkgs ? import <nixpkgs> { pkgs ? import <nixpkgs> {
config = { allowUnfree = true; }; config = { allowUnfree = true; };
} },
, # Enable all Intel specific extensions which only works on x86_64 # Enable all Intel specific extensions which only works on x86_64
enableIntelX86Extensions ? true enableIntelX86Extensions ? true
}: }:
pkgs.callPackage ./nixGL.nix ({ pkgs.callPackage ./nixGL.nix ({
@ -29,8 +28,8 @@ pkgs.callPackage ./nixGL.nix ({
nvidiaHash nvidiaHash
enable32bits enable32bits
; ;
} // (if enableIntelX86Extensions then { } } // (if enableIntelX86Extensions then {}
else { else {
intel-media-driver = null; intel-media-driver = null;
vaapiIntel = null; vaapiIntel = null;
})) }))

View File

@ -1,65 +0,0 @@
#!/usr/bin/env python3
import urllib3
import json
http = urllib3.PoolManager()
dl_dir = http.request("GET", "https://download.nvidia.com/XFree86/Linux-x86_64/")
# print(f"{dl_dir.status=}\n{dl_dir.data=}")
assert (dl_dir.status < 400), "Error probably occurred"
def find_versions(dir_html: bytes) -> list[str]:
# this algorithm obviously need recursion because we need to discover the items
def _rec(dir_html: bytes, start: int = 0, so_far: list[str] = []) -> list[str]:
MATCH_START = b"<span class=\'dir\'><a href=\'"
potential_start = dir_html.find(MATCH_START, start)
if potential_start == -1:
return so_far
# check that it starts with a number
potential_version_start = potential_start + len(MATCH_START)
p = potential_version_start
if not (dir_html[p: p+1].decode().isnumeric()):
return _rec(dir_html, potential_version_start, so_far)
# this thing matches, add to so_far and continue
version_end = dir_html.find(b"/", potential_version_start)
assert version_end != -1, "There should be matching /"
so_far.append(dir_html[potential_version_start:version_end].decode())
return _rec(dir_html, version_end, so_far)
return _rec(dir_html, 0, [])
versions = find_versions(dl_dir.data)
# print("\n".join(versions))
download_urls = lambda ver: [f"https://download.nvidia.com/XFree86/Linux-x86_64/{ver}/NVIDIA-Linux-x86_64-{ver}.run"]
sha256_urls = lambda ver: [f"{url}{dl_ext}" for dl_ext in [".sha256sum", ".sha256"] for url in download_urls(ver)]
def req_monad(url: str, err_fn, then_fn):
res = http.request("GET", url)
if res.status >= 400:
return err_fn(res.status)
return then_fn(res.data)
identity = lambda e: e
none_id = lambda _: None
def get_sha256(version: str) -> str | None:
for url in sha256_urls(version):
res = http.request("GET", url)
# print(f"attempting: {url}")
if res.status < 400:
return res.data.decode().split()[0]
return None
fetch_data = [(v, download_urls(v)[0], get_sha256(v)) for v in versions]
fetch_data.append(("latest", *fetch_data[-1][1:]))
# print(fetch_data)
# now print the JSON object
print(json.dumps({
version: {
"url": dl_url,
"sha256": sha256
} for (version, dl_url, sha256) in fetch_data if sha256 is not None}, indent=4))
# execution: fetch.py >nvidia_versions.json

View File

@ -8,14 +8,12 @@
(flake-utils.lib.eachDefaultSystem (system: (flake-utils.lib.eachDefaultSystem (system:
let let
isIntelX86Platform = system == "x86_64-linux"; isIntelX86Platform = system == "x86_64-linux";
nix_pkgs = import nixpkgs { inherit system; };
pkgs = import ./default.nix { pkgs = import ./default.nix {
pkgs = nix_pkgs; pkgs = nixpkgs.legacyPackages.${system};
enable32bits = isIntelX86Platform; enable32bits = isIntelX86Platform;
enableIntelX86Extensions = isIntelX86Platform; enableIntelX86Extensions = isIntelX86Platform;
}; };
in in rec {
rec {
packages = { packages = {
# makes it easy to use "nix run nixGL --impure -- program" # makes it easy to use "nix run nixGL --impure -- program"
@ -32,16 +30,16 @@
# deprecated attributes for retro compatibility # deprecated attributes for retro compatibility
defaultPackage = packages; defaultPackage = packages;
})) // rec { })) // rec {
# deprecated attributes for retro compatibility # deprecated attributes for retro compatibility
overlay = overlays.default; overlay = overlays.default;
overlays.default = final: _: overlays.default = final: _:
let isIntelX86Platform = final.system == "x86_64-linux"; let isIntelX86Platform = final.system == "x86_64-linux";
in { in {
nixgl = import ./default.nix { nixgl = import ./default.nix {
pkgs = final; pkgs = final;
enable32bits = isIntelX86Platform; enable32bits = isIntelX86Platform;
enableIntelX86Extensions = isIntelX86Platform; enableIntelX86Extensions = isIntelX86Platform;
};
}; };
}; };
};
} }

View File

@ -1,42 +1,22 @@
{ { # # Nvidia informations.
# # Nvidia informations. # Version of the system kernel module. Let it to null to enable auto-detection.
# Version of the system kernel module. Let it to null to enable auto-detection. nvidiaVersion ? null,
nvidiaVersion ? null # Hash of the Nvidia driver .run file. null is fine, but fixing a value here
, # Hash of the Nvidia driver .run file. null is fine, but fixing a value here # will be more reproducible and more efficient.
# will be more reproducible and more efficient. nvidiaHash ? null,
nvidiaHash ? null # Alternatively, you can pass a path that points to a nvidia version file
, # Alternatively, you can pass a path that points to a nvidia version file # and let nixGL extract the version from it. That file must be a copy of
# and let nixGL extract the version from it. That file must be a copy of # /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see
# /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see # https://github.com/NixOS/nix/issues/3539 ).
# https://github.com/NixOS/nix/issues/3539 ). nvidiaVersionFile ? null,
nvidiaVersionFile ? null # Enable 32 bits driver
, # Enable 32 bits driver # This is one by default, you can switch it to off if you want to reduce a
# This is one by default, you can switch it to off if you want to reduce a # bit the size of nixGL closure.
# bit the size of nixGL closure. enable32bits ? true
enable32bits ? true , writeTextFile, shellcheck, pcre, runCommand, linuxPackages
, writeTextFile , fetchurl, lib, runtimeShell, bumblebee, libglvnd, vulkan-validation-layers
, shellcheck , mesa, libvdpau-va-gl, intel-media-driver, vaapiIntel, pkgsi686Linux, driversi686Linux
, pcre , zlib, libdrm, xorg, wayland, gcc }:
, runCommand
, linuxPackages
, fetchurl
, lib
, runtimeShell
, bumblebee
, libglvnd
, vulkan-validation-layers
, mesa
, libvdpau-va-gl
, intel-media-driver
, vaapiIntel
, pkgsi686Linux
, driversi686Linux
, zlib
, libdrm
, xorg
, wayland
, gcc
}:
let let
writeExecutable = { name, text }: writeExecutable = { name, text }:
@ -56,173 +36,162 @@ let
done done
''; '';
}; };
fetch_db = builtins.fromJSON (builtins.readFile ./nvidia_versions.json);
top = rec { top = rec {
/* /*
It contains the builder for different nvidia configuration, parametrized by It contains the builder for different nvidia configuration, parametrized by
the version of the driver and sha256 sum of the driver installer file. the version of the driver and sha256 sum of the driver installer file.
*/ */
nvidiaPackages = { version, sha256 ? fetch_db."${version}".sha256 }: nvidiaPackages = { version, sha256 ? null }: rec {
let nvidiaDrivers = (linuxPackages.nvidia_x11.override { }).overrideAttrs
nvidiaDrivers = (linuxPackages.nvidia_x11.override { }).overrideAttrs (oldAttrs: rec {
(oldAttrs: { pname = "nvidia";
pname = "nvidia"; name = "nvidia-x11-${version}-nixGL";
name = "nvidia-x11-${version}-nixGL"; inherit version;
inherit version; src = let
src = url =
let "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}.run";
url = in if sha256 != null then
"https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}.run"; fetchurl { inherit url sha256; }
in else
fetchurl { inherit url sha256; }; builtins.fetchurl url;
useGLVND = true; useGLVND = true;
}); });
nvidiaLibsOnly = nvidiaDrivers.override {
libsOnly = true;
kernel = null;
};
nixNvidiaWrapper = api:
writeExecutable {
name = "nix${api}Nvidia-${version}";
text = ''
#!${runtimeShell}
${lib.optionalString (api == "Vulkan")
"export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d"}
NVIDIA_JSON=(${nvidiaLibsOnly}/share/glvnd/egl_vendor.d/*nvidia.json)
${lib.optionalString enable32bits "NVIDIA_JSON32=(${nvidiaLibsOnly.lib32}/share/glvnd/egl_vendor.d/*nvidia.json)"}
${''export __EGL_VENDOR_LIBRARY_FILENAMES=''${NVIDIA_JSON[*]}${ nvidiaLibsOnly = nvidiaDrivers.override {
lib.optionalString enable32bits libsOnly = true;
'':''${NVIDIA_JSON32[*]}'' kernel = null;
}"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"'' };
}
${ nixGLNvidiaBumblebee = writeExecutable {
lib.optionalString (api == "Vulkan") name = "nixGLNvidiaBumblebee-${version}";
''export VK_ICD_FILENAMES=${nvidiaLibsOnly}/share/vulkan/icd.d/nvidia_icd.json${ text = ''
lib.optionalString enable32bits #!${runtimeShell}
":${nvidiaLibsOnly.lib32}/share/vulkan/icd.d/nvidia_icd.json" export LD_LIBRARY_PATH=${
}"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}"'' lib.makeLibraryPath [ nvidiaDrivers ]
} }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH=${ ${
lib.makeLibraryPath ([ libglvnd nvidiaLibsOnly ] bumblebee.override {
++ lib.optional (api == "Vulkan") vulkan-validation-layers nvidia_x11 = nvidiaDrivers;
++ lib.optionals enable32bits [ nvidia_x11_i686 = nvidiaDrivers.lib32;
nvidiaLibsOnly.lib32 }
pkgsi686Linux.libglvnd }/bin/optirun --ldpath ${
]) lib.makeLibraryPath ([ libglvnd nvidiaDrivers ]
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" ++ lib.optionals enable32bits [
exec "$@" nvidiaDrivers.lib32
''; pkgsi686Linux.libglvnd
}; ])
in } "$@"
{ '';
inherit nvidiaDrivers nvidiaLibsOnly; };
nixGLNvidiaBumblebee = writeExecutable { # TODO: 32bit version? Not tested.
name = "nixGLNvidiaBumblebee-${version}"; nixNvidiaWrapper = api:
writeExecutable {
name = "nix${api}Nvidia-${version}";
text = '' text = ''
#!${runtimeShell} #!${runtimeShell}
export LD_LIBRARY_PATH=${ ${lib.optionalString (api == "Vulkan")
lib.makeLibraryPath [ nvidiaDrivers ] "export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d"}
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" NVIDIA_JSON=(${nvidiaLibsOnly}/share/glvnd/egl_vendor.d/*nvidia.json)
${ ${lib.optionalString enable32bits "NVIDIA_JSON32=(${nvidiaLibsOnly.lib32}/share/glvnd/egl_vendor.d/*nvidia.json)"}
bumblebee.override {
nvidia_x11 = nvidiaDrivers; ${''export __EGL_VENDOR_LIBRARY_FILENAMES=''${NVIDIA_JSON[*]}${
nvidia_x11_i686 = nvidiaDrivers.lib32; lib.optionalString enable32bits
'':''${NVIDIA_JSON32[*]}''
}"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"''
}
${
lib.optionalString (api == "Vulkan")
''export VK_ICD_FILENAMES=${nvidiaLibsOnly}/share/vulkan/icd.d/nvidia_icd.json${
lib.optionalString enable32bits
":${nvidiaLibsOnly.lib32}/share/vulkan/icd.d/nvidia_icd.json"
}"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}"''
} }
}/bin/optirun --ldpath ${ export LD_LIBRARY_PATH=${
lib.makeLibraryPath ([ libglvnd nvidiaDrivers ] lib.makeLibraryPath ([ libglvnd nvidiaLibsOnly ]
++ lib.optionals enable32bits [ ++ lib.optional (api == "Vulkan") vulkan-validation-layers
nvidiaDrivers.lib32 ++ lib.optionals enable32bits [
pkgsi686Linux.libglvnd nvidiaLibsOnly.lib32
]) pkgsi686Linux.libglvnd
} "$@" ])
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec "$@"
''; '';
}; };
# TODO: 32bit version? Not tested. # TODO: 32bit version? Not tested.
inherit nixNvidiaWrapper; nixGLNvidia = nixNvidiaWrapper "GL";
# TODO: 32bit version? Not tested. # TODO: 32bit version? Not tested.
nixGLNvidia = nixNvidiaWrapper "GL"; nixVulkanNvidia = nixNvidiaWrapper "Vulkan";
};
# TODO: 32bit version? Not tested.
nixVulkanNvidia = nixNvidiaWrapper "Vulkan";
};
nixGLIntel = writeExecutable { nixGLIntel = writeExecutable {
name = "nixGLIntel"; name = "nixGLIntel";
# add the 32 bits drivers if needed # add the 32 bits drivers if needed
text = text = let
let mesa-drivers = [ mesa.drivers ]
mesa-drivers = [ mesa.drivers ] ++ lib.optional enable32bits pkgsi686Linux.mesa.drivers;
++ lib.optional enable32bits pkgsi686Linux.mesa.drivers; intel-driver = [ intel-media-driver vaapiIntel ]
intel-driver = [ intel-media-driver vaapiIntel ] # Note: intel-media-driver is disabled for i686 until https://github.com/NixOS/nixpkgs/issues/140471 is fixed
# Note: intel-media-driver is disabled for i686 until https://github.com/NixOS/nixpkgs/issues/140471 is fixed ++ lib.optionals enable32bits [ /* pkgsi686Linux.intel-media-driver */ driversi686Linux.vaapiIntel ];
++ lib.optionals enable32bits [ /* pkgsi686Linux.intel-media-driver */ driversi686Linux.vaapiIntel ]; libvdpau = [ libvdpau-va-gl ]
libvdpau = [ libvdpau-va-gl ] ++ lib.optional enable32bits pkgsi686Linux.libvdpau-va-gl;
++ lib.optional enable32bits pkgsi686Linux.libvdpau-va-gl; glxindirect = runCommand "mesa_glxindirect" { } (''
glxindirect = runCommand "mesa_glxindirect" { } ( mkdir -p $out/lib
'' ln -s ${mesa.drivers}/lib/libGLX_mesa.so.0 $out/lib/libGLX_indirect.so.0
mkdir -p $out/lib '');
ln -s ${mesa.drivers}/lib/libGLX_mesa.so.0 $out/lib/libGLX_indirect.so.0 in ''
'' #!${runtimeShell}
); export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" mesa-drivers}
in export LIBVA_DRIVERS_PATH=${lib.makeSearchPathOutput "out" "lib/dri" intel-driver}
'' ${''export __EGL_VENDOR_LIBRARY_FILENAMES=${mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json${
#!${runtimeShell} lib.optionalString enable32bits
export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" mesa-drivers} ":${pkgsi686Linux.mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json"
export LIBVA_DRIVERS_PATH=${lib.makeSearchPathOutput "out" "lib/dri" intel-driver} }"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"''
${''export __EGL_VENDOR_LIBRARY_FILENAMES=${mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json${ }
lib.optionalString enable32bits export LD_LIBRARY_PATH=${lib.makeLibraryPath mesa-drivers}:${lib.makeSearchPathOutput "lib" "lib/vdpau" libvdpau}:${glxindirect}/lib:${lib.makeLibraryPath [libglvnd]}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
":${pkgsi686Linux.mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json" exec "$@"
}"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"'' '';
}
export LD_LIBRARY_PATH=${lib.makeLibraryPath mesa-drivers}:${lib.makeSearchPathOutput "lib" "lib/vdpau" libvdpau}:${glxindirect}/lib:${lib.makeLibraryPath [libglvnd]}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec "$@"
'';
}; };
nixVulkanIntel = writeExecutable { nixVulkanIntel = writeExecutable {
name = "nixVulkanIntel"; name = "nixVulkanIntel";
text = text = let
let # generate a file with the listing of all the icd files
# generate a file with the listing of all the icd files icd = runCommand "mesa_icd" { } (
icd = runCommand "mesa_icd" { } ( # 64 bits icd
# 64 bits icd ''
'' ls ${mesa.drivers}/share/vulkan/icd.d/*.json > f
ls ${mesa.drivers}/share/vulkan/icd.d/*.json > f ''
'' # 32 bits ones
# 32 bits ones + lib.optionalString enable32bits ''
+ lib.optionalString enable32bits '' ls ${pkgsi686Linux.mesa.drivers}/share/vulkan/icd.d/*.json >> f
ls ${pkgsi686Linux.mesa.drivers}/share/vulkan/icd.d/*.json >> f ''
'' # concat everything as a one line string with ":" as seperator
# concat everything as a one line string with ":" as seperator + ''cat f | xargs | sed "s/ /:/g" > $out'');
+ ''cat f | xargs | sed "s/ /:/g" > $out'' in ''
); #!${runtimeShell}
in if [ -n "$LD_LIBRARY_PATH" ]; then
'' echo "Warning, nixVulkanIntel overwriting existing LD_LIBRARY_PATH" 1>&2
#!${runtimeShell} fi
if [ -n "$LD_LIBRARY_PATH" ]; then export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d
echo "Warning, nixVulkanIntel overwriting existing LD_LIBRARY_PATH" 1>&2 ICDS=$(cat ${icd})
fi export VK_ICD_FILENAMES=$ICDS"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}"
export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d export LD_LIBRARY_PATH=${
ICDS=$(cat ${icd}) lib.makeLibraryPath [
export VK_ICD_FILENAMES=$ICDS"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}" zlib
export LD_LIBRARY_PATH=${ libdrm
lib.makeLibraryPath [ xorg.libX11
zlib xorg.libxcb
libdrm xorg.libxshmfence
xorg.libX11 wayland
xorg.libxcb gcc.cc
xorg.libxshmfence ]
wayland }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
gcc.cc exec "$@"
] '';
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec "$@"
'';
}; };
nixGLCommon = nixGL: nixGLCommon = nixGL:
@ -232,57 +201,48 @@ let
cp ${nixGL}/bin/* "$out/bin/nixGL"; cp ${nixGL}/bin/* "$out/bin/nixGL";
''; '';
auto = auto = let
let _nvidiaVersionFile = if nvidiaVersionFile != null then
_nvidiaVersionFile = nvidiaVersionFile
if nvidiaVersionFile != null then else
nvidiaVersionFile # HACK: Get the version from /proc. It turns out that /proc is mounted
else # inside of the build sandbox and varies from machine to machine.
# HACK: Get the version from /proc. It turns out that /proc is mounted #
# inside of the build sandbox and varies from machine to machine. # builtins.readFile is not able to read /proc files. See
# # https://github.com/NixOS/nix/issues/3539.
# builtins.readFile is not able to read /proc files. See runCommand "impure-nvidia-version-file" {
# https://github.com/NixOS/nix/issues/3539. # To avoid sharing the build result over time or between machine,
runCommand "impure-nvidia-version-file" # Add an impure parameter to force the rebuild on each access.
{ # time = builtins.currentTime;
# To avoid sharing the build result over time or between machine, preferLocalBuild = true;
# Add an impure parameter to force the rebuild on each access. allowSubstitutes = false;
# time = builtins.currentTime; } "cp /proc/driver/nvidia/version $out 2> /dev/null || touch $out";
preferLocalBuild = true;
allowSubstitutes = false;
} "cp /proc/driver/nvidia/version $out 2> /dev/null || touch $out";
# The nvidia version. Either fixed by the `nvidiaVersion` argument, or # The nvidia version. Either fixed by the `nvidiaVersion` argument, or
# auto-detected. Auto-detection is impure. # auto-detected. Auto-detection is impure.
nvidiaVersionAuto = nvidiaVersionAuto = if nvidiaVersion != null then
if nvidiaVersion != null then nvidiaVersion
nvidiaVersion else
else # Get if from the nvidiaVersionFile
# Get if from the nvidiaVersionFile let
let data = builtins.readFile _nvidiaVersionFile;
data = builtins.readFile _nvidiaVersionFile; versionMatch = builtins.match ".*Module ([0-9.]+) .*" data;
versionMatch = builtins.match ".*Module ([0-9.]+) .*" data; in if versionMatch != null then builtins.head versionMatch else null;
in
if versionMatch != null then builtins.head versionMatch else null;
autoNvidia = nvidiaPackages { version = nvidiaVersionAuto; }; autoNvidia = nvidiaPackages {version = nvidiaVersionAuto; };
in in rec {
rec { # The output derivation contains nixGL which point either to
# The output derivation contains nixGL which point either to # nixGLNvidia or nixGLIntel using an heuristic.
# nixGLNvidia or nixGLIntel using an heuristic. nixGLDefault = if nvidiaVersionAuto != null then
nixGLDefault = nixGLCommon autoNvidia.nixGLNvidia
if nvidiaVersionAuto != null then else
nixGLCommon autoNvidia.nixGLNvidia nixGLCommon nixGLIntel;
else } // autoNvidia;
nixGLCommon nixGLIntel;
} // autoNvidia;
}; };
in in top // (if nvidiaVersion != null then
top // (if nvidiaVersion != null then top.nvidiaPackages {
top.nvidiaPackages version = nvidiaVersion;
{ sha256 = nvidiaHash;
version = nvidiaVersion; }
sha256 = nvidiaHash;
}
else else
{ }) { })

View File

@ -3,5 +3,4 @@ let
in in
import (fetchTarball { import (fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz"; url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz";
sha256 = "14sm0bjjcmi9qmznwy3nkd2vbhj5xcshgm54a5wiprl9ssvxqw53";
}) })

View File

@ -1,570 +0,0 @@
{
"256.25": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.25/NVIDIA-Linux-x86_64-256.25.run",
"sha256": "a93e4de6df8336741ace5a4bd2bc80b3b0b0ebde8c31003671af91bc44db61d3"
},
"256.29": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.29/NVIDIA-Linux-x86_64-256.29.run",
"sha256": "e387780b265e9eec2f68295f7f08dab0238c87426e9968d8dd9d02d6ff023da3"
},
"256.35": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.35/NVIDIA-Linux-x86_64-256.35.run",
"sha256": "ef10ecddd8db11f0fa3c6e4727dc275eb0ca9d23a7b7d37a038d17d2a42acb2a"
},
"256.38.02": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.38.02/NVIDIA-Linux-x86_64-256.38.02.run",
"sha256": "c3c9c60932830a648034b98f38910058df339a84ad5998adc8df19c697fd6663"
},
"256.38.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.38.03/NVIDIA-Linux-x86_64-256.38.03.run",
"sha256": "0dcb0098e294d5b89f57b8100f6af660225310ba48b4298a2ac79bb19cc8ca7c"
},
"256.44": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.44/NVIDIA-Linux-x86_64-256.44.run",
"sha256": "528aaed18b6b4ba79dbf4ae5c5ecda8350007d610d2c7c608eb646739cfeb500"
},
"256.52": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.52/NVIDIA-Linux-x86_64-256.52.run",
"sha256": "3ab713f969fe7cf0d7ccfdfee2863c92ea96d1eb5bf3f734b3a1e5b37c2611c8"
},
"256.53": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.53/NVIDIA-Linux-x86_64-256.53.run",
"sha256": "febee3eb128e1d62565fccb3ad1577f741c4bf067072e45e7766ab999aa590c9"
},
"260.19.04": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.04/NVIDIA-Linux-x86_64-260.19.04.run",
"sha256": "09391b63daa6bc08ea520c28295a8535b83710f8ba48d01778bf7fe22d095485"
},
"260.19.06": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.06/NVIDIA-Linux-x86_64-260.19.06.run",
"sha256": "ecd3e2113fbf9dd7e167c737d3b4490dd653b49b70ead62c194635ffc3fd4d00"
},
"260.19.12": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.12/NVIDIA-Linux-x86_64-260.19.12.run",
"sha256": "7cc90b5bd402742167a1647d0d92aa997af4184da614c2ca882afb2f2e48eb7e"
},
"260.19.21": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.21/NVIDIA-Linux-x86_64-260.19.21.run",
"sha256": "bf80147e94ab4c86dffe4529635e5f5b0caff5f6758a068d0e2d95ee466d2214"
},
"260.19.26": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.26/NVIDIA-Linux-x86_64-260.19.26.run",
"sha256": "78ce4e3344ee15330708054b5c3ceabb96aabaa1194a9bc92cee9559c7cd3c9f"
},
"260.19.29": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.29/NVIDIA-Linux-x86_64-260.19.29.run",
"sha256": "09461a1eb6f46b394e9a2cfef20448311a395c3969521881b334c413715174eb"
},
"260.19.36": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.36/NVIDIA-Linux-x86_64-260.19.36.run",
"sha256": "35a8769585e1f9b426c9c21b5f5898c06251a642ed73e9fb9eea9ab87ef91067"
},
"260.19.44": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.44/NVIDIA-Linux-x86_64-260.19.44.run",
"sha256": "8526267407d71b1257e43abc2b98e588c8d271e30584a754b8b8ef426cc69c64"
},
"270.18": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.18/NVIDIA-Linux-x86_64-270.18.run",
"sha256": "b10af40db402f9f8e6a3a5a55b2385a06e2b8b14c8fc539624b07c63d70bef32"
},
"270.26": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.26/NVIDIA-Linux-x86_64-270.26.run",
"sha256": "120ead8941ad6c9ea5bc263e12b004e6c4639151469cfe46a99781ab1cc1f33a"
},
"270.29": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.29/NVIDIA-Linux-x86_64-270.29.run",
"sha256": "c45209b72b2a0128fa4721c616dd51ad799e2698d46f672b006c4b2cc0c44f9c"
},
"270.30": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.30/NVIDIA-Linux-x86_64-270.30.run",
"sha256": "5f49d1497c60ea3d82e6640ebc233e05c855adf5f6702dfc0a5c73773f26207e"
},
"270.41.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.41.03/NVIDIA-Linux-x86_64-270.41.03.run",
"sha256": "35dd4a1d89228a8ffc26dd9513aaf806e67826c42ff34954e2bd576068abd0b5"
},
"270.41.06": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.41.06/NVIDIA-Linux-x86_64-270.41.06.run",
"sha256": "825c593e77d33df599b2cfe2a3b4cde0c61b837a843a3caa6469298de721f2fa"
},
"270.41.19": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.41.19/NVIDIA-Linux-x86_64-270.41.19.run",
"sha256": "4d7131f07e739abc787d69696ca4ac52df2fc0b338405ffd474288c2a4a1e7a6"
},
"275.09": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.09/NVIDIA-Linux-x86_64-275.09.run",
"sha256": "e4c94cbd85f619c2b83f6c53bddc8a7b7ce306f28b80c8cfacdfba884da45f4d"
},
"275.09.04": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.09.04/NVIDIA-Linux-x86_64-275.09.04.run",
"sha256": "dceb415aec70d7fa2bafea45268b1913100cc19e08e57dfda0f0920caad43b68"
},
"275.09.07": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.09.07/NVIDIA-Linux-x86_64-275.09.07.run",
"sha256": "747c09b0a0a8d60e1b5fee49fb1ea07ee5812f8e85a87b2403011af6de58164d"
},
"275.19": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.19/NVIDIA-Linux-x86_64-275.19.run",
"sha256": "58bf5d90fbabd30c5980a8ce5fe831337ccfe0ab843e78e0b0b12eec8e327e40"
},
"275.21": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.21/NVIDIA-Linux-x86_64-275.21.run",
"sha256": "9e071aef05545ece8f2836b57f49f73853adb998f9987669c4803549fb50f479"
},
"275.28": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.28/NVIDIA-Linux-x86_64-275.28.run",
"sha256": "fc1dfded42d21b08f40fa7f50589c6c0c4922cc0d30af71bf721ab8682b00648"
},
"275.36": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.36/NVIDIA-Linux-x86_64-275.36.run",
"sha256": "91a8c8865514fbeec20fa90c00690011426ad7b5d5c9a221f7ced253d94ddab7"
},
"275.43": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.43/NVIDIA-Linux-x86_64-275.43.run",
"sha256": "468515a3b3fb2423dc47a6066e2f1b646ec78283b008a3702c111e5cfd3f5dc2"
},
"280.04": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/280.04/NVIDIA-Linux-x86_64-280.04.run",
"sha256": "e230b25462ab4eeba71363f12360d4785223c023111f08d21ce1a7456665e712"
},
"280.11": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/280.11/NVIDIA-Linux-x86_64-280.11.run",
"sha256": "9d56c08c45a0648c62f00745413f0828549928f0e4e7549bea3d9fce8e498e5f"
},
"280.13": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/280.13/NVIDIA-Linux-x86_64-280.13.run",
"sha256": "98a08c7d943912a178a9bbe419db60634088e5262ae9053bf2fe730984e5a012"
},
"285.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/285.03/NVIDIA-Linux-x86_64-285.03.run",
"sha256": "fc1e895635b9ea7171f4e7c549e6502f3853838cb4cc254a190b004579a1f919"
},
"285.05.09": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/285.05.09/NVIDIA-Linux-x86_64-285.05.09.run",
"sha256": "7159a1f7e898b50dd49ea2273ac6facb870546ad5496bf70c6fbe1642d2c4970"
},
"290.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/290.03/NVIDIA-Linux-x86_64-290.03.run",
"sha256": "14a412b6a01cd9ae98b1dba0f1a2805c9038fd731dd66747ca57ab6ec4f550b0"
},
"290.06": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/290.06/NVIDIA-Linux-x86_64-290.06.run",
"sha256": "48df72cd225043ebecbe1a6a9a575d692e0a9fa0b0bb65c037800d83ba54f3ec"
},
"290.10": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/290.10/NVIDIA-Linux-x86_64-290.10.run",
"sha256": "34a2ab07f4ae7afdeb2c8415f3f37c1099e6690eb25f3dbef92eca771f7ce4cd"
},
"295.09": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.09/NVIDIA-Linux-x86_64-295.09.run",
"sha256": "4b2ff7f9fcc1db6f30f4b4a2eb5a22bc5fe1c566828e3d6a56ef088d187bf786"
},
"295.17": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.17/NVIDIA-Linux-x86_64-295.17.run",
"sha256": "b1fede162dce9c3d31a991cf48a4743dacece05cfef86dafac8e8284369a86c2"
},
"295.20": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.20/NVIDIA-Linux-x86_64-295.20.run",
"sha256": "3b84fdeae335c047193f68a1da26f2a736461c35cfe94566fc7ace1e5762d34c"
},
"295.33": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.33/NVIDIA-Linux-x86_64-295.33.run",
"sha256": "4e939bac1ebc03c6439969d638540b99900b0fe4e4799b4186e5ff9521d37b73"
},
"295.40": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.40/NVIDIA-Linux-x86_64-295.40.run",
"sha256": "f6d5ae338b3b8ac6c512d06b335010934a62728f181a1fa5253aa84b7bf45e7a"
},
"295.49": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.49/NVIDIA-Linux-x86_64-295.49.run",
"sha256": "61dc9623ea1981f801d97de7c67c32b7e4f7ef4aaa6744910967cb634d9ace62"
},
"295.53": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.53/NVIDIA-Linux-x86_64-295.53.run",
"sha256": "4525e994a0d0a8cd776415401423e7de3985923637642955c3fe50a3d047d4ca"
},
"295.59": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.59/NVIDIA-Linux-x86_64-295.59.run",
"sha256": "4b1d96389abd2b804ad470c5189142a02ee4c82c1ac56cea37ecb45e8051313e"
},
"295.71": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.71/NVIDIA-Linux-x86_64-295.71.run",
"sha256": "956c7660bff61c07a99cea2130e73baf1574907008d41d9462147aad6b83dcc6"
},
"295.75": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.75/NVIDIA-Linux-x86_64-295.75.run",
"sha256": "b7ae04da001ade59b87abd15e7786b3f0fc75a312368fa466f6c0400e803debd"
},
"302.07": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/302.07/NVIDIA-Linux-x86_64-302.07.run",
"sha256": "6a9e515c21afed122621a69a844a2891bb625773e481ebfe70699bf2d06be5e1"
},
"302.11": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/302.11/NVIDIA-Linux-x86_64-302.11.run",
"sha256": "e44816814bce58a9f1cf0d10edec1a2f4b25104a212714c2bbd1bc9e70b53f61"
},
"302.17": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/302.17/NVIDIA-Linux-x86_64-302.17.run",
"sha256": "5cf9059ebb70ade99e5621c0a605ed5bbb6c274f7c52a7ef40342ceb41b381fc"
},
"304.22": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.22/NVIDIA-Linux-x86_64-304.22.run",
"sha256": "4c1b6f7dcda007622bb5e243b858abdb3881d5d5befdc617b23393545d9c96fd"
},
"304.30": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.30/NVIDIA-Linux-x86_64-304.30.run",
"sha256": "ada4deee8a7a19093af7bb724dfd55e2594fb28932ff915723532ddf16b85e1f"
},
"304.32": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.32/NVIDIA-Linux-x86_64-304.32.run",
"sha256": "a26d6c64108371027fbca1b35b182d0ff1609dd53ce6f9d06fea85f039393bc8"
},
"304.37": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.37/NVIDIA-Linux-x86_64-304.37.run",
"sha256": "cae75158047d0b97ea48f269fd2903a6731f53b978a1065720343436c97ca9c2"
},
"304.43": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.43/NVIDIA-Linux-x86_64-304.43.run",
"sha256": "76946e2fe4160cfd59e7a75fefd174a9c7e71c51cca6b88c40a16cf35947b777"
},
"304.48": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.48/NVIDIA-Linux-x86_64-304.48.run",
"sha256": "c018541d30e4f276e1afc60077e5c75b54954daa8888c870fc80a19b28d4eae8"
},
"304.51": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.51/NVIDIA-Linux-x86_64-304.51.run",
"sha256": "28654ff26923660de7296488054154bbbac0ef6e669377eeed84178fd0c17e64"
},
"304.60": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.60/NVIDIA-Linux-x86_64-304.60.run",
"sha256": "12dbd2661e8b6114fa3f531cb0c7a6820c98198aa6044bddff0d2431141bc6d0"
},
"304.64": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.64/NVIDIA-Linux-x86_64-304.64.run",
"sha256": "b3c3bb7f136ccd978c9c5a511a02199ec2498c4243baae19ac68e5d905ca5340"
},
"304.84": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.84/NVIDIA-Linux-x86_64-304.84.run",
"sha256": "8d51e0a8e5bd20d0add5dbacdcdb95eba05bc01d17c3bb247b5a1880feb0e0fe"
},
"304.88": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.88/NVIDIA-Linux-x86_64-304.88.run",
"sha256": "c1a73211566b085214b0ad1824733aa56d09c6139f729feebd0eff44f6113da3"
},
"304.108": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.108/NVIDIA-Linux-x86_64-304.108.run",
"sha256": "56a61871f0488521f50c04607c568a177cad48a577c0f4ca625665d0015e2b39"
},
"304.116": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.116/NVIDIA-Linux-x86_64-304.116.run",
"sha256": "3f267f2cd3f4ede4f954c5f36c8427ae4a2fa19ca8c275f892488f4dc3a4109a"
},
"304.117": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.117/NVIDIA-Linux-x86_64-304.117.run",
"sha256": "0e5a751cf12b55057c00ccf53d05c8934d5eee49c5f8b3f33c5e11e2c6989e6e"
},
"304.119": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.119/NVIDIA-Linux-x86_64-304.119.run",
"sha256": "1fd710a78d2bf711ede3bcbd20058de1e94c498db31973dfec1b8c25bf87e6cd"
},
"304.121": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.121/NVIDIA-Linux-x86_64-304.121.run",
"sha256": "6532eef8b6f65dc44ed912b4ffa86494a954ae98f53c3ffd394fa511cdf75928"
},
"304.123": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.123/NVIDIA-Linux-x86_64-304.123.run",
"sha256": "68ee60d2a96ff80adad7e62f79f55f137dd10b8c38ce6c60fb481e73fdf6b155"
},
"304.125": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.125/NVIDIA-Linux-x86_64-304.125.run",
"sha256": "c654889b85a18326f2c610260a8fbc3b1bb6f9b8be1c052a46a213f60bd62262"
},
"304.128": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.128/NVIDIA-Linux-x86_64-304.128.run",
"sha256": "e301342b93af24a6676519cb3a7fbe5d557b6a23a588ef121478b7fbab8a495f"
},
"310.14": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.14/NVIDIA-Linux-x86_64-310.14.run",
"sha256": "a187cc9de4939b171b600544e8dbf78dbb1a05cb481b2b3b506c3699f8e6c4c7"
},
"310.19": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.19/NVIDIA-Linux-x86_64-310.19.run",
"sha256": "3326cf9eb432a10fee5cb663132cd6c175813d0225750ef237dcc7feefd20fca"
},
"310.32": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.32/NVIDIA-Linux-x86_64-310.32.run",
"sha256": "e5f179a62d1a0e6a877f3f89315d0a28cb7c3cbceff7df13e1a71ab189ac3616"
},
"310.40": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.40/NVIDIA-Linux-x86_64-310.40.run",
"sha256": "48fc9ff847b57ce959b401ad37040dc1332f9c0b3bdef08c246dba91e091a65e"
},
"310.44": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.44/NVIDIA-Linux-x86_64-310.44.run",
"sha256": "585365fc37939794ab7ed6907ab2fd9fbcc6f4f19c003d21139895dc97dd88f4"
},
"310.51": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.51/NVIDIA-Linux-x86_64-310.51.run",
"sha256": "4d0f9829105a8f06121f8308fa5e67834f52b84add48eaf4101b02522db15f53"
},
"313.09": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.09/NVIDIA-Linux-x86_64-313.09.run",
"sha256": "11cc2c4d32da321ad7ce63b9cdb41578400542d0b9d0ac6c5061a3253db96e13"
},
"313.18": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.18/NVIDIA-Linux-x86_64-313.18.run",
"sha256": "9aaf6ce2fb08f72b2ab4f7a2d9fc5af8216ac263fa4883deec3844f34ea7ba3a"
},
"313.26": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.26/NVIDIA-Linux-x86_64-313.26.run",
"sha256": "4cbf3ec4fe1ce0b24ebbdcc3badde369aeb98ab59b6689261fa39f2dde00d41e"
},
"313.30": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.30/NVIDIA-Linux-x86_64-313.30.run",
"sha256": "72317f2e4c459c33c764e3283deb3e1615b1852ead1f9bfad82148e120506022"
},
"319.12": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.12/NVIDIA-Linux-x86_64-319.12.run",
"sha256": "4b68617d75d0d1149d2d6e836783429c715204fad567aa621ae7982df676a8d4"
},
"319.17": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.17/NVIDIA-Linux-x86_64-319.17.run",
"sha256": "5579a8c4f5a7927eb9756d276c4e3d60540877cd68f6c946890fddc5d176764a"
},
"319.23": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.23/NVIDIA-Linux-x86_64-319.23.run",
"sha256": "d130dd0a9d889063d0dbad0a27789af756076af879a68a5dbc1175821542fa78"
},
"319.32": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.32/NVIDIA-Linux-x86_64-319.32.run",
"sha256": "204a00728c3cfbe3dcb12a9dae5bf0371a1e5b2c48dedf86a2bb6c881e901e2a"
},
"319.49": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.49/NVIDIA-Linux-x86_64-319.49.run",
"sha256": "f4bfee9f48725e20e05439ee099730fb1b42892b9ecfac000180426b044be585"
},
"319.60": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.60/NVIDIA-Linux-x86_64-319.60.run",
"sha256": "2bd663d0d0a9ae8769b0335ff282acfddea3cd86a3992970e445eb2f82fa1b04"
},
"319.72": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.72/NVIDIA-Linux-x86_64-319.72.run",
"sha256": "25a15200d6fd58782db860c7bc0807583b1d78c13810013c024700e63df4c643"
},
"319.82": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.82/NVIDIA-Linux-x86_64-319.82.run",
"sha256": "9e00555488fd1c934a86ccf04f3a9eb8c5bcbc29ea38ce66d72788d0bd9dde7b"
},
"325.08": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/325.08/NVIDIA-Linux-x86_64-325.08.run",
"sha256": "83a567dc6b1ddd0c74af1ebc54e966ae19f52baa17166981046af4d6288c6ce4"
},
"325.15": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/325.15/NVIDIA-Linux-x86_64-325.15.run",
"sha256": "01446fbd94f6eb3b2e1b3d3f2b06970bf470c3ee2cb1838b3d0c2416e6c74500"
},
"331.13": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.13/NVIDIA-Linux-x86_64-331.13.run",
"sha256": "571741b8ea153281916382d287849f99a9fa65b911aa54d678b48ef0091cc0cd"
},
"331.17": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.17/NVIDIA-Linux-x86_64-331.17.run",
"sha256": "22968b7bd6460456e99edcad18ec237ebe66fd19e349c9ec9c3d5a16c074eab4"
},
"331.20": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.20/NVIDIA-Linux-x86_64-331.20.run",
"sha256": "b8803906402354d201d3b9bc21938a0fe8a7d76e93e486fddaab340df18092ec"
},
"331.38": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.38/NVIDIA-Linux-x86_64-331.38.run",
"sha256": "1015ac65a85ba39bdbe9e6bac54ae7ce3b2441fc7512909074e991242a46cf34"
},
"331.49": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.49/NVIDIA-Linux-x86_64-331.49.run",
"sha256": "ee0e0c3e95439e3d55e76aa6477fdb62bc62c04805b3efaa1f028ea64d2422f8"
},
"331.67": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.67/NVIDIA-Linux-x86_64-331.67.run",
"sha256": "9c7f2bb44bb26a5effb915d8aa22132a6c06483e0cfa6f47b7265b15da83bbd7"
},
"331.79": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.79/NVIDIA-Linux-x86_64-331.79.run",
"sha256": "c3314bd7f1f722929a2b401e12301a750ee7a73640518932a5a9af39c390a604"
},
"331.89": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.89/NVIDIA-Linux-x86_64-331.89.run",
"sha256": "e7f51a6c7abfe3ba8f03dbb284e2ade7430cc909b2241ff7703b17beff0dd237"
},
"331.104": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.104/NVIDIA-Linux-x86_64-331.104.run",
"sha256": "e0a26dc4444e84dae876db773f717e33846e1ae8a23802795ba3d39f1631f79e"
},
"331.113": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.113/NVIDIA-Linux-x86_64-331.113.run",
"sha256": "e9d5eb4394ef31825f7a86290b19b522851d1b599284095d81bac0f33a996219"
},
"334.16": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/334.16/NVIDIA-Linux-x86_64-334.16.run",
"sha256": "59a930f7ed6391a1e57b9fc7683420facd1c4548757d4120b1c594479af759f7"
},
"334.21": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/334.21/NVIDIA-Linux-x86_64-334.21.run",
"sha256": "dd35011967b815e096c267f80b36664e34d779bc33017f396dabbd1a1b86d057"
},
"337.12": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/337.12/NVIDIA-Linux-x86_64-337.12.run",
"sha256": "8fa588e0491e652a1cfd45aa01be9336c9b5bb5dd54bf45801a40d53d957e4b4"
},
"337.19": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/337.19/NVIDIA-Linux-x86_64-337.19.run",
"sha256": "bd6998c4aa5e491fb8fcb957b11dfb983ebfb755e938fce0382b006a7aba59d2"
},
"337.25": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/337.25/NVIDIA-Linux-x86_64-337.25.run",
"sha256": "83280f7738f65bb2e790e7530a38978cf0bd0aa741eda51629c9e9b068128af0"
},
"340.17": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.17/NVIDIA-Linux-x86_64-340.17.run",
"sha256": "b3311d4bc82dd1c58805f2ac29d20711f2b0c0978407bba138d603606e603662"
},
"340.24": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.24/NVIDIA-Linux-x86_64-340.24.run",
"sha256": "db0f4f45ece587b95a8ceb0d1acf6f7f758a370ee0c4adfa2403ba4828d58ce6"
},
"340.32": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.32/NVIDIA-Linux-x86_64-340.32.run",
"sha256": "ef96003110564953cad4ffaec073696dcf9652338dfe5eb0c58ae3ce45db42ac"
},
"340.46": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.46/NVIDIA-Linux-x86_64-340.46.run",
"sha256": "57e7694b5a985ee95d2da37598ec37cdabf40f914490f4cdb0c5184f12a74270"
},
"340.58": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.58/NVIDIA-Linux-x86_64-340.58.run",
"sha256": "70cc452161b969d659225a3a7d4cc17d5827f8f8ce6eb053757f30f6a666a643"
},
"340.65": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.65/NVIDIA-Linux-x86_64-340.65.run",
"sha256": "cd3948db5c1e2468c50140efb4bb50f1a4c84c923db8ec756bd56ff35df9ff04"
},
"340.76": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.76/NVIDIA-Linux-x86_64-340.76.run",
"sha256": "3bf670e9a2bdb184648dec54ce06fab65e798a9a4c9dd5155e2be4efee3e0994"
},
"340.93": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.93/NVIDIA-Linux-x86_64-340.93.run",
"sha256": "ea2ac747fd473ea55ed5f6263bd314efa94c71384f3e03d527f8d550ba84c218"
},
"343.13": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/343.13/NVIDIA-Linux-x86_64-343.13.run",
"sha256": "424a7d0fbf668c94454a140c880c298c71496ad7dee699a0bfc594c70e499e54"
},
"343.22": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/343.22/NVIDIA-Linux-x86_64-343.22.run",
"sha256": "762e9d3c1253712a5a62f7052d58e4768eaea3f0492cab934dbf5349c8523315"
},
"343.36": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/343.36/NVIDIA-Linux-x86_64-343.36.run",
"sha256": "2285efa2c0e6675d8724e47a09403630a674c32e514bdcfb54cec3c81810fc78"
},
"346.16": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.16/NVIDIA-Linux-x86_64-346.16.run",
"sha256": "d44bc3f868ce9cbd6c5bbe88d8622f693ef44282f14ed018d150fcab21a0ce32"
},
"346.22": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.22/NVIDIA-Linux-x86_64-346.22.run",
"sha256": "ecb3edab63ff053aa1d6e19eb0a69360075ab1b021e5181a6df738e29be9b71a"
},
"346.35": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.35/NVIDIA-Linux-x86_64-346.35.run",
"sha256": "8625acbbc7a2abdda436a5cb9d06f2a7f5913b16e0a35ac4f9f106853a94d086"
},
"346.47": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.47/NVIDIA-Linux-x86_64-346.47.run",
"sha256": "85ab28abe9defc2838839969b31aea647e0de34615fbfed3ba716205de365d0a"
},
"346.59": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.59/NVIDIA-Linux-x86_64-346.59.run",
"sha256": "231020548431569c0172605815ba131a18f969966b4abf82129f974740bc64ca"
},
"346.72": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.72/NVIDIA-Linux-x86_64-346.72.run",
"sha256": "2ae3777bcff6bf4883b6a903c82b82257bf8fc323fe174992df96a3208c50cef"
},
"346.82": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.82/NVIDIA-Linux-x86_64-346.82.run",
"sha256": "f68b74479a2c329628fed061977e99f744980329c94b6e9c3f396714f2a10f0e"
},
"346.87": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.87/NVIDIA-Linux-x86_64-346.87.run",
"sha256": "908446b20c9992cc6a7700866d36c13d9f53646837842d096d91b35644ee4e31"
},
"346.96": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.96/NVIDIA-Linux-x86_64-346.96.run",
"sha256": "229b28a6b65965a248d07223d941de7d79b54cee7c6574f1037293e8a8026727"
},
"349.12": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/349.12/NVIDIA-Linux-x86_64-349.12.run",
"sha256": "fe2e3be342859d2de947aed55c369f4944211ecde00435c76e50a4842fffd68a"
},
"349.16": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/349.16/NVIDIA-Linux-x86_64-349.16.run",
"sha256": "f980b22729b20c9eb3a3a800af524da181afbc78e2409a3f83845894983f8322"
},
"352.09": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.09/NVIDIA-Linux-x86_64-352.09.run",
"sha256": "a3ec271896b775c936e1a14e7af2e8ebf02b0bd59381217510185b313c5a5fd6"
},
"352.21": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.21/NVIDIA-Linux-x86_64-352.21.run",
"sha256": "aadfbd991b5418cbf89d2368cc49485a4194196ef08362a18f92df049381f791"
},
"352.30": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.30/NVIDIA-Linux-x86_64-352.30.run",
"sha256": "4c5fb75ba94c97b6d70ddb9ea2cb11b5ed01829b5f671d9e8abce7afba20aef5"
},
"352.41": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.41/NVIDIA-Linux-x86_64-352.41.run",
"sha256": "0eb60d0543a0e7c5c3cfec13702005ffec6e2b8c7f22c631f324736ba2a1a832"
},
"355.06": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/355.06/NVIDIA-Linux-x86_64-355.06.run",
"sha256": "898304e1455bbccad4a3da3520d7fe17db254413f3458d0a296b45fb9cf2bcd6"
},
"355.11": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/355.11/NVIDIA-Linux-x86_64-355.11.run",
"sha256": "a59b425381add9d9058dc2d987bf3087ab59c43224b5eb04c3f273f5886451ed"
},
"470.161.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/470.161.03/NVIDIA-Linux-x86_64-470.161.03.run",
"sha256": "5da82a7f8c76e781e7d7f0be7b798db4d344f26bd4facf9abcf3c71c71fe7640"
},
"510.108.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/510.108.03/NVIDIA-Linux-x86_64-510.108.03.run",
"sha256": "410a515e78df29c2cba4ac0b497889ce0ff1b04cfc711ff889e2dfc80f0da0d8"
},
"515.86.01": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/515.86.01/NVIDIA-Linux-x86_64-515.86.01.run",
"sha256": "141777e1ca2f11e97d8d33260213f1be327eb73922ae22f4ddab404bb2ef4664"
},
"525.53": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.53/NVIDIA-Linux-x86_64-525.53.run",
"sha256": "74bb0971f04f1dddd3c4641c891706fb96e8de52e22f6079e50de76d3a51687f"
},
"525.60.11": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.60.11/NVIDIA-Linux-x86_64-525.60.11.run",
"sha256": "816ee6c2e0813ccc3d4a7958f71fc49a37c60efe1d51d6146c1ce72403983d5d"
},
"525.60.13": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.60.13/NVIDIA-Linux-x86_64-525.60.13.run",
"sha256": "dce1c184f9f038be72237ccd29c66bb151077f6037f1c158c83d582bd2dba8ca"
},
"525.78.01": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.78.01/NVIDIA-Linux-x86_64-525.78.01.run",
"sha256": "43da42d2bf69bc37ea9c7c0fa02f52db0dcc483c272f52edacad89a5cb495a93"
},
"latest": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.78.01/NVIDIA-Linux-x86_64-525.78.01.run",
"sha256": "43da42d2bf69bc37ea9c7c0fa02f52db0dcc483c272f52edacad89a5cb495a93"
}
}

View File

@ -1,42 +1,20 @@
flake_input@{ kpcli-py, nixgl, rust-overlay, neovim-nightly-overlay, ... }: [ flake_input@{ kpcli-py, nixgl, rust-overlay, ... }: [
# TODO: this is quite harmful to add globally. nixGL is built not to be pure
nixgl.overlays.default nixgl.overlays.default
rust-overlay.overlays.default rust-overlay.overlays.default
(final: prev: {
neovim-nightly-overlay.overlay # use python3.9, which works because of cython somehow?
kpcli-py = final.poetry2nix.mkPoetryApplication {
(final: prev: projectDir = kpcli-py;
let python = final.python39;
nightlyRustWithExts = exts: final.rust-bin.selectLatestNightlyWith ( overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: {
toolchain: (toolchain.minimal.override { # tableformatter requires setuptools
extensions = exts; tableformatter = super.tableformatter.overridePythonAttrs (
}) old: {
); buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools super.cython_3 ];
# https://rust-lang.github.io/rustup/concepts/profiles.html }
rust-default-components = [ "rust-docs" "rustfmt" "clippy" ]; );
rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ]; });
in };
{ })
# use python3.9, which works because of cython somehow?
kpcli-py = final.poetry2nix.mkPoetryApplication {
projectDir = kpcli-py;
python = final.python39;
overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: {
# tableformatter requires setuptools
tableformatter = super.tableformatter.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools super.cython_3 ];
}
);
});
};
rust4devs = nightlyRustWithExts rust-dev-components;
rust4cargo = nightlyRustWithExts [ ];
rust4normi = nightlyRustWithExts rust-default-components;
})
] ]

View File

@ -19,10 +19,10 @@ fi
SCRIPT_DIR=$(realpath $(dirname $0)) SCRIPT_DIR=$(realpath $(dirname $0))
echo "SCRIPT_DIR: ${SCRIPT_DIR}" echo "SCRIPT_DIR: ${SCRIPT_DIR}"
SYSNIX_DIR="${SCRIPT_DIR}/.." SYSNIX_DIR="${SCRIPT_DIR}/../nix-conf/system"
# Copy hardware-configuration of existing machine onto our version control # Copy hardware-configuration of existing machine onto our version control
SYSNIX_PROF="${SYSNIX_DIR}/hosts/${HOSTNAME}" SYSNIX_PROF="${SYSNIX_DIR}/profiles/${HOSTNAME}"
HARDWARE_CONF="${SYSNIX_PROF}/hardware-configuration.nix" HARDWARE_CONF="${SYSNIX_PROF}/hardware-configuration.nix"
if [ ! -f "${HARDWARE_CONF}" ]; then if [ ! -f "${HARDWARE_CONF}" ]; then
mkdir "$SYSNIX_PROF" mkdir "$SYSNIX_PROF"

View File

@ -7,27 +7,15 @@ echo "SCRIPT_DIR: ${SCRIPT_DIR}"
HOME_MANAGER_DIR="${SCRIPT_DIR}/../nix-conf/home-manager" HOME_MANAGER_DIR="${SCRIPT_DIR}/../nix-conf/home-manager"
# Manage nix.conf. Ideally, this should be done with snapshot-based version
# and with preview on-the-spot, with some timeout
if [ -f /etc/nix/nix.conf ]; then
# managed nix.conf
BACKUP_FILE="/etc/nix/nix.conf.backup"
echo "overwriting /etc/nix/nix.conf. Please find latest backup in ${BACKUP_FILE}"
sudo cp /etc/nix/nix.conf ${BACKUP_FILE}
sudo cp "${HOME_MANAGER_DIR}/hwtr/nix.conf" /etc/nix/
fi
# Mason is bad: it puts binaries onto xdg.data # Mason is bad: it puts binaries onto xdg.data
# let's make mason starts fresh, just in case we introduce RPATH hacks
# that injects binary for Mason to use.
rm -rf ~/.local/share/nvim/mason rm -rf ~/.local/share/nvim/mason
# test if we have home-manager, if not, attempt to use nix to put home-manager to # test if we have home-manager, if not, attempt to use nix to put home-manager to
# our environment # our environment
if [ $(home-manager help >/dev/null 2>&1) ]; then if [ $(home-manager >/dev/null 2>&1) ]; then
nix-shell -p home-manager --run "home-manager switch --flake $HOME_MANAGER_DIR $@" nix-shell -p home-manager --run "home-manager switch --flake $HOME_MANAGER_DIR"
else else
home-manager switch -b backup --flake "$HOME_MANAGER_DIR" $@ home-manager switch -b backup --flake "$HOME_MANAGER_DIR"
fi fi

View File

@ -1,22 +1,10 @@
let (import
inherit ((import (
( let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in fetchTarball {
fetchTarball { url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; sha256 = lock.nodes.flake-compat.locked.narHash;
sha256 = lock.nodes.flake-compat.locked.narHash; }
} )
) { src = ./.; }
{ src = ./.; } ).defaultNix.secrets
).defaultNix) secrets;
inherit (secrets) pubKeys;
inherit (pubKeys) users hosts;
all = users // hosts;
c_ = builtins;
in
{
"secrets/s3fs.age".publicKeys = c_.attrValues (all);
"secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all);
"secrets/_nhitrl.age".publicKeys = c_.attrValues (all);
"secrets/wifi.env.age".publicKeys = c_.attrValues (all);
}

Binary file not shown.

View File

@ -1,6 +1,5 @@
# TODO: put ssh keys as user/host config # TODO: put ssh keys as user/host config
inputs: inputs: let
let
# user-specific (~/.ssh/id_ed25519.pub) # user-specific (~/.ssh/id_ed25519.pub)
users = { users = {
"hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; "hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z";
@ -12,8 +11,7 @@ let
all = users // systems; all = users // systems;
# stands for calculus # stands for calculus
c_ = builtins; c_ = builtins;
in in {
{
"system/secrets/s3fs.age".publicKeys = c_.attrValues (all); "system/secrets/s3fs.age".publicKeys = c_.attrValues (all);
"system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all); "system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all);
"system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all); "system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all);

View File

@ -1,10 +1,10 @@
age-encryption.org/v1 age-encryption.org/v1
-> ssh-ed25519 ahbzMg Lx4TLKDZ2yk3DQsM6nOOI1o+FHu0lNtT2p3PBdao+C4 -> ssh-ed25519 ahbzMg 6pTVLAgOY/JZVWiCFHLo8xQ4/CL6620IMaBRpqI8Wws
RsTScUeLmFrO6v1OOxBbyBCMBMVhsGrtu5W9iMOw8B0 CtJeQuy5VzKZhJnIH+/cjlKsAcg0RY2bhHTWVm+hUOY
-> ssh-ed25519 glsjZQ CdLCkzb1dBoG9gYdMisaZBZT+nnzfOX326CWq6cvN1s -> ssh-ed25519 glsjZQ we7RCgsnODTJ8rKYhU+9tu0DmLH+98mcQKQ3I2slikM
UKGCxej9lZnLzsuFJnFOMpyrz7YzJrHcrFuDz8l8RQk G81lsFLQR9polxme1K/MU2d8Y01PrTqtzJnVq0EMJF0
-> U<J-grease + A6h/F, 'mix -> |-grease B\W,I9z ^Gx;$ Kk7!4,P
jpEa7b7rRo6bVpTr19c5ALOfaeiP0jldtpQBRWfJnma3VSo3kkDQpfa3RvPjZfD8 0Jl5Lhx7R8YOs9S+hUtQDDpNIqBhC/MM0N7w1MCtwYtkIIIWKfY9jkJ7+Cew2Ee5
Eg9Zb03MKMUAJnWwfLCXVFQqEVpSaIwI+ujLZ5Cm Qb04jnE
--- /a+J/jeGoWwuNvDEAIGzU0WKx86oH+YRTnSexf+8NP4 --- b7AXWRgK45a/91iwmwt5g+CWOlU/2f4nUDfXlg/bs9A
!]FµO¬Jv”žó%×-ŻtÚŹŘťuzčB­É˙}ś‡Ő"C\;D (ľ‡ĂFŠÎ®j®ëA7&ąü<C485>˛?é.ć…J•áBa»„ąŽ˛[ŘdXrŢŚO ¢²%;Þ3RmQÚWhpÌVŠ;º×®¡¥VÍÚñ[zš9al¦±=cLêüva<>ëu7é,†tø±ýUܶh^&å‰Ö¿WåJP6-ÇÒ£ n-ˆ¿=™]

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +1,8 @@
# TODO: templates should be able to have initial states like # TODO: templates should be able to have initial states like
# repo name, author,... # repo name, author,...
{ pkgs {pkgs
, lib ,lib
, ... ,...
}: { }: {
rust = { rust = {
path = ./rust; path = ./rust;

View File

@ -3,6 +3,10 @@
debug/ debug/
target/ target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt # These are backup files generated by rustfmt
**/*.rs.bk **/*.rs.bk

View File

@ -1,41 +0,0 @@
# Rust-monorepo. TODO: Change this to your monorepo name
## About this template
[![built with nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org)
- Bootstrapped with [pegasust/dotfiles](https://git.pegasust.com/pegasust/dotfiles)
- Uses [naersk](https://github.com/nix-community/naersk.git) to build package(s)
- Provides [devShell (`nix develop`)](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html),
[shell.nix (`nix-shell -p ./`)](https://nixos.org/manual/nix/stable/command-ref/nix-shell.html)
for development environment. It contains:
- The default `devShell` provides Nightly rustc via
[`gh:oxalica/rust-overlay`](https://github.com/oxalica/rust-overlay.git)
- [rustc components](https://rust-lang.github.io/rustup/concepts/components.html) includes
`rust-src`, [`rust-analyzer`](https://github.com/rust-lang/rust-analyzer.git),
`clippy`, `miri`
- [`evcxr`: Rust REPL]() and [`bacon`: Rust nodemon]()
## Check out these [killer libraries](https://jondot.medium.com/12-killer-rust-libraries-you-should-know-c60bab07624f)
### Application development
- [Serde](https://github.com/serde-rs/serde) for (de)serialization needs
- Data-driven programming in Rust starts with Serde
- Service system programming starts with defining your message protocols & data formats
- [Clap](https://docs.rs/clap/latest/clap/) declarative CLI arguments
- Data-driven CLI development in Rust starts with Clap
- [itertools](https://lib.rs/crates/itertools) for extra juice to iterators
- [log](https://lib.rs/crates/log) or [env-logger](https://docs.rs/env_logger/latest/env_logger)
for logging needs
### Library development
- [proptest](https://lib.rs/crates/proptest) for hyppothesis testing
- Data-driven testing starts with proptest

View File

@ -1,4 +0,0 @@
[cargo-new]
# since we already have a root .git
vcs = "none" # enum["git", "hg", "pijul", "fossil", "none"]

View File

@ -1,10 +1,7 @@
(import (import (
( fetchTarball {
fetchTarball { url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; ) {
} src = ./.;
) }).defaultNix
{
src = ./.;
}).defaultNix

View File

@ -25,13 +25,6 @@
devShell = with pkgs; mkShell { devShell = with pkgs; mkShell {
buildInputs = [ buildInputs = [
rust_pkgs rust_pkgs
# rust's compiler is quite powerful enough to the point where
# a REPL is not really necessary.
# Rely on the compiler and bacon 99% of the time
# only use REPL if you need to explore/prototype
# In that case, might as well put the code into sandbox
pkgs.evcxr
pkgs.bacon
]; ];
shellHook = '' shellHook = ''
# nix flake update # is this even needed? # nix flake update # is this even needed?

View File

@ -1,10 +1,7 @@
(import (import (
( fetchTarball {
fetchTarball { url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; ) {
} src = ./.;
) }).shellNix
{
src = ./.;
}).shellNix

View File

@ -1,10 +1,7 @@
(import (import (
( fetchTarball {
fetchTarball { url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; ) {
} src = ./.;
) }).defaultNix
{
src = ./.;
}).defaultNix

View File

@ -11,28 +11,22 @@
let let
overlays = [ rust-overlay.overlays.default ]; overlays = [ rust-overlay.overlays.default ];
pkgs = import nixpkgs { inherit system overlays; }; pkgs = import nixpkgs { inherit system overlays; };
rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith
(
toolchain:
toolchain.default.override {
extensions = [ "rust-src" "rust-analyzer" "rust-docs" "clippy" "miri" ];
}
));
naersk-lib = pkgs.callPackage naersk { }; naersk-lib = pkgs.callPackage naersk { };
in in
{ {
defaultPackage = naersk-lib.buildPackage ./.; defaultPackage = naersk-lib.buildPackage ./.;
devShell = with pkgs; mkShell { devShell = with pkgs; mkShell {
buildInputs = [ buildInputs = [
rust_pkgs (pkgs.rust-bin.selectLatestNightlyWith
# rust's compiler is quite powerful enough to the point where (
# a REPL is not really necessary. toolchain:
# Rely on the compiler and bacon 99% of the time toolchain.default.override {
# only use REPL if you need to explore/prototype extensions = [ "rust-src" ];
# In that case, might as well put the code into sandbox }
pkgs.evcxr ))
pkgs.bacon pkgs.rust-analyzer
]; ];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
shellHook = '' shellHook = ''
# nix flake update # is this even needed? # nix flake update # is this even needed?
''; '';

View File

@ -1,10 +1,7 @@
(import (import (
( fetchTarball {
fetchTarball { url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; ) {
} src = ./.;
) }).shellNix
{
src = ./.;
}).shellNix

View File

@ -1,13 +0,0 @@
{ lib, ... }@inputs:
let
config = {
hungtr.metadata = { };
"hungtr@bao".metadata = {
ssh_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z";
};
};
in
{
homeConfigurations = { };
pubKeys = lib.getPubkey config;
}