Merge pull request 'Pure NVIDIA autodetection for NixGL' (#5) from top-level-wip into master

Reviewed-on: #5
pull/6/head^2
pegasust 2023-01-14 13:10:27 +00:00
commit ab3e8c6a9e
80 changed files with 2192 additions and 915 deletions

View File

@ -4,17 +4,21 @@
# 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": 1665870395, "lastModified": 1673301561,
"narHash": "sha256-Tsbqb27LDNxOoPLh0gw2hIb6L/6Ow/6lIBvqcHzEKBI=", "narHash": "sha256-gRUWHbBAtMuPDJQXotoI8u6+3DGBIUZHkyQWpIv7WpM=",
"owner": "ryantm", "owner": "ryantm",
"repo": "agenix", "repo": "agenix",
"rev": "a630400067c6d03c9b3e0455347dc8559db14288", "rev": "42d371d861a227149dc9a7e03350c9ab8b8ddd68",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -36,6 +36,22 @@
"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,
@ -53,11 +69,11 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1667395993,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -81,6 +97,21 @@
"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": [
@ -89,11 +120,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1672770368, "lastModified": 1673343300,
"narHash": "sha256-iO6Z9blIe8dcPh3VT2nkej9EimORCoskGQR6xNjICWI=", "narHash": "sha256-5Xdj6kpXYMie0MlnGwqK5FaMdsedxvyuakWtyKB3zaQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "d01e7280ad7d13a5a0fae57355bd0dbfe5b81969", "rev": "176e455371a8371586e8a3ff0d56ee9f3ca2324e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -118,11 +149,75 @@
"type": "github" "type": "github"
} }
}, },
"nixgl": { "neovim-flake": {
"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"
}
},
"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": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_2"
},
"locked": { "locked": {
"lastModified": 1, "lastModified": 1,
"narHash": "sha256-KP+2qdZlhmRkrafuuEofg7YnNdVmGV95ipvpuqmJneI=", "narHash": "sha256-KP+2qdZlhmRkrafuuEofg7YnNdVmGV95ipvpuqmJneI=",
@ -135,6 +230,22 @@
} }
}, },
"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=",
@ -149,13 +260,13 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1672617983, "lastModified": 1673450908,
"narHash": "sha256-68WDiCBs631mbDDk4UAKdGURKcsfW6hjb7wgudTAe5o=", "narHash": "sha256-b8em+kwrNtnB7gR8SyVf6WuTyQ+6tHS6dzt9D9wgKF0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", "rev": "6c8644fc37b6e141cbfa6c7dc8d98846c4ff0c2e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -164,7 +275,7 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_3": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1665296151, "lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
@ -187,22 +298,24 @@
"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_2", "nixpkgs": "nixpkgs_3",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1672712534, "lastModified": 1673490397,
"narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=", "narHash": "sha256-VCSmIYJy/ZzTvEGjdfITmTYfybXBgZpMjyjDndbou+8=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f", "rev": "0833f4d063a2bb75aa31680f703ba594a384ffe6",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -22,34 +22,39 @@
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, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat { nixpkgs
,... , agenix
}@_inputs: let , home-manager
, flake-utils
, nixgl
, rust-overlay
, flake-compat
, neovim-nightly-overlay
, nix-index-database
, ...
}@_inputs:
let
# Context/global stuffs to be passed down # Context/global stuffs to be passed down
# TODO: adapt to different platforms think about different systems later
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = import ./overlays.nix _inputs;
config = {
allowUnfree = true;
};
};
# 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 = let proj_root =
let
path = builtins.toString ./.; path = builtins.toString ./.;
in { in
{
inherit path; inherit path;
configs.path = "${path}/native-configs"; configs.path = "${path}/native_configs";
scripts.path = "${path}/scripts"; scripts.path = "${path}/scripts";
secrets.path = "${path}/secrets"; secrets.path = "${path}/secrets";
testdata.path = "${path}/tests"; testdata.path = "${path}/tests";
@ -57,12 +62,35 @@
hosts.path = "${path}/hosts"; hosts.path = "${path}/hosts";
users.path = "${path}/users"; users.path = "${path}/users";
}; };
} _inputs); # TODO: adapt to different platforms think about different systems later
inputs_w_pkgs = (_lib.recursiveUpdate {inherit pkgs; lib = pkgs.lib;} inputs); system = "x86_64-linux";
lib = _lib.recursiveUpdate (import ./lib inputs_w_pkgs) _lib; 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
# lib = nixpkgs.lib // pkgs.lib;
lib = (builtins.foldl' (lhs: rhs: (nixpkgs.lib.recursiveUpdate lhs rhs)) { } [
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;
});
# update inputs with our library and past onto our end configurations
inputs_w_lib = (lib.recursiveUpdate {inherit lib;} inputs_w_pkgs);
modules = (import ./modules inputs_w_lib); modules = (import ./modules inputs_w_lib);
hosts = (import ./hosts inputs_w_lib); hosts = (import ./hosts inputs_w_lib);
users = (import ./users inputs_w_lib); users = (import ./users inputs_w_lib);
@ -83,18 +111,26 @@
expected = "for sure"; expected = "for sure";
}; };
}; };
secrets = import ./secrets final_inputs;
in { in
{
inherit (hosts) nixosConfigurations; inherit (hosts) nixosConfigurations;
# inherit (users) homeConfigurations; inherit (users) homeConfigurations;
inherit lib; inherit lib proj_root;
devShell."${system}" = import ./dev-shell.nix final_inputs; devShell."${system}" = import ./dev-shell.nix final_inputs;
templates = import ./templates final_inputs; templates = import ./templates final_inputs;
secrets = {
pubKeys = {
hosts = hosts.pubKeys;
users = users.pubKeys;
};
};
unit_tests = lib.runTests unit_tests; unit_tests = lib.runTests unit_tests;
secrets = import ./secrets final_inputs;
debug = { debug = {
inherit final_inputs hosts users modules lib inputs_w_pkgs unit_tests pkgs; inherit final_inputs hosts users modules lib inputs_w_lib unit_tests pkgs nixpkgs;
}; };
formatter."${system}" = pkgs.nixpkgs-fmt;
}; };
} }

View File

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

View File

@ -5,24 +5,28 @@
{ {
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,6 +1,19 @@
{nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat { nixpkgs
,pkgs, lib, proj_root, nixosDefaultVersion? "22.05", defaultSystem? "x86_64-linux",...}@finalInputs: let , agenix
config = { , home-manager
, flake-utils
, nixgl
, rust-overlay
, flake-compat
, pkgs
, lib
, proj_root
, nixosDefaultVersion ? "22.05"
, defaultSystem ? "x86_64-linux"
, ...
}@finalInputs:
let
config = {
bao.metadata = { bao.metadata = {
# req # req
hostName = "bao"; hostName = "bao";
@ -10,55 +23,65 @@ config = {
system = "x86_64-linux"; system = "x86_64-linux";
preset = "base"; preset = "base";
}; };
# TODO: add override so that we can add wsl config on top
bao.nixosConfig = { bao.nixosConfig = {
modules = [ modules = [
import ../modules/kde.sys.nix (import ../modules/nvgpu.sys.nix)
import ../modules/pulseaudio.sys.nix (import ../modules/kde.sys.nix)
import ../modules/storage.perso.sys.nix (import ../modules/pulseaudio.sys.nix)
(import ../modules/storage.perso.sys.nix)
]; ];
}; };
}; };
propagate = hostConfig@{metadata, nixosConfig}: let propagate = hostConfig@{ metadata, nixosConfig }:
let
# req # req
inherit (metadata) hostName; inherit (metadata) hostName;
# opts # opts
ssh_pubkey = lib.attrByPath ["ssh_pubkey"] null metadata; # metadata.ssh_pubkey??undefined ssh_pubkey = lib.attrByPath [ "ssh_pubkey" ] null metadata; # metadata.ssh_pubkey??undefined
users = lib.attrByPath ["users"] {} metadata; users = lib.attrByPath [ "users" ] { } metadata;
nixosVersion = lib.attrByPath ["nixosVersion"] nixosDefaultVersion metadata; nixosVersion = lib.attrByPath [ "nixosVersion" ] nixosDefaultVersion metadata;
system = lib.attrByPath ["system"] defaultSystem metadata; system = lib.attrByPath [ "system" ] defaultSystem metadata;
preset = lib.attrByPath ["preset"] "base" metadata; preset = lib.attrByPath [ "preset" ] "base" metadata;
# infer # infer
hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix"; hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix";
in { # alias to prevent infinite recursion
_nixosConfig = nixosConfig;
in
{
inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig; inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig;
nixosConfig = nixosConfig // { nixosConfig = _nixosConfig // {
inherit system; inherit system;
lib = finalInputs.lib;
modules = [ modules = [
{
config._module.args = {
inherit proj_root;
my-lib = finalInputs.lib;
};
}
hardwareConfig
{ {
system.stateVersion = nixosVersion; system.stateVersion = nixosVersion;
networking.hostName = hostName; networking.hostName = hostName;
users.users = users; users.users = users;
} }
{ {
_module.args = finalInputs; imports = [ agenix.nixosModule ];
environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ];
} }
import "${proj_root.modules.path}/secrets.nix" (import "${proj_root.modules.path}/secrets.nix")
import "${proj_root.modules.path}/${preset}.sys.nix" (import "${proj_root.modules.path}/${preset}.sys.nix")
] ++ nixosConfig.modules; ] ++ _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;
}; };
# 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 ...";}
hostKeys = trimNull (flattenPubkey config); pubKeys = lib.getPubkey config;
} }

View File

@ -5,7 +5,8 @@
{ {
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" ];
@ -23,13 +24,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,4 +1,11 @@
{nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat { nixpkgs
,pkgs, lib, proj_root}: { , agenix
, home-manager
} , flake-utils
, nixgl
, rust-overlay
, flake-compat
, pkgs
, lib
, proj_root
}: { }

View File

@ -5,7 +5,8 @@
{ {
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" ];
@ -13,7 +14,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;
@ -23,13 +24,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

@ -0,0 +1 @@

View File

@ -1,22 +1,35 @@
{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;
serde = import ./serde.nix inputs // {inherit lib;}; inputs_w_lib = (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
shellAsDrv = {script, pname}: (pkgs.callPackage ( inherit shellAsDrv trimNull flattenPubkey getPubkey;
# just a pattern that we must remember: args to this are children of pkgs. ssh = {
{writeShellScriptBin}: writeShellScriptBin pname script inherit flattenPubkey getPubkey;
) {}); };
# Configures hosts as nixosConfiguration # Configures hosts as nixosConfiguration
# mkHost = {hostName # mkHost = {hostName
# , nixosBareConfiguration # , nixosBareConfiguration

View File

@ -3,7 +3,7 @@
# 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
@ -16,13 +16,15 @@ 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,3 +1 @@
{lib,...}: { { lib, ... }: { }
}

6
modules/amdgpu.sys.nix Normal file
View File

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

View File

@ -1,14 +1,15 @@
{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: { }

12
modules/gpu.sys.nix Normal file
View File

@ -0,0 +1,12 @@
{ 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,7 +1,8 @@
{ pkgs { pkgs
, lib , my-lib
, ...
}: { }: {
environment.noXlibs = lib.mkForce false; environment.noXlibs = my-lib.mkForce false;
# TODO: wireless networking # TODO: wireless networking
# Enable the X11 windowing system. # Enable the X11 windowing system.

View File

@ -1,12 +1,15 @@
{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-optimize-store = true; nix.settings.auto-optimise-store = true;
nix.package = pkgs.nixFlakes; # nix flakes nix.package = pkgs.nixFlakes; # nix flakes
nix.extraOptions = '' nix.extraOptions = ''
experimental=feature = nix-command flakes experimental-features = nix-command flakes
''; '';
programs.neovim = { programs.neovim = {
enable = true; enable = true;
@ -22,6 +25,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}/ssh/authorized_keys"); openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile "${proj_root.configs.path}/ssh/authorized_keys");
}; };
} }

View File

@ -1,8 +1,9 @@
{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

7
modules/nvgpu.sys.nix Normal file
View File

@ -0,0 +1,7 @@
{ 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;
}

21
modules/opengl.sys.nix Normal file
View File

@ -0,0 +1,21 @@
{ 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,8 +1,6 @@
{agenix { proj_root
,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
@ -15,5 +13,8 @@
age.secrets._nhitrl_cred = { age.secrets._nhitrl_cred = {
file = "${proj_root.secrets.path}/_nhitrl.age"; file = "${proj_root.secrets.path}/_nhitrl.age";
}; };
environment.systemPackages = [agenix.defaultPackage.x86_64-linux]; age.secrets."wifi.env" = {
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 = false; permitRootLogin = "no";
}; };
} }

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,7 +70,8 @@
bucket = "digital-garden"; bucket = "digital-garden";
}) })
( (
let args = { let
args = {
"-fstype" = "cifs"; "-fstype" = "cifs";
credentials = config.age.secrets._nhitrl_cred.path; credentials = config.age.secrets._nhitrl_cred.path;
user = null; user = null;
@ -79,10 +80,12 @@
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 args = { let
args = {
"-fstype" = "cifs"; "-fstype" = "cifs";
credentials = config.age.secrets._nhitrl_cred.path; credentials = config.age.secrets._nhitrl_cred.path;
user = null; user = null;
@ -91,7 +94,8 @@
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,8 +1,9 @@
{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 = {

8
modules/wifi.sys.nix Normal file
View File

@ -0,0 +1,8 @@
{ 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,19 +20,37 @@ 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') Plug('nvim-lua/plenary.nvim') -- The base of all plugins
-- 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')
@ -67,15 +85,17 @@ 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
Plug('gruvbox-community/gruvbox') -- theme provider cfg_render(function()
Plug('nvim-lualine/lualine.nvim') -- fancy status line Plug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts
Plug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines Plug('gruvbox-community/gruvbox') -- theme provider
Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes Plug('nvim-lualine/lualine.nvim') -- fancy status line
Plug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog Plug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines
Plug('folke/todo-comments.nvim') -- Highlights TODO Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes
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' })
@ -84,6 +104,11 @@ 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')
@ -95,12 +120,13 @@ 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
@ -154,7 +180,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

@ -66,7 +66,7 @@ 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;

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.useNixGLPackage != null; cfgEnable = cfg.enable or (cfg.useNixGL.defaultPackage != 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 = cfgEnable; base.graphics._enable = lib.mkForce true;
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

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

View File

@ -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

@ -16,6 +16,22 @@
"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,
@ -33,11 +49,11 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1667395993,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -61,6 +77,21 @@
"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": [
@ -69,11 +100,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1672770368, "lastModified": 1673343300,
"narHash": "sha256-iO6Z9blIe8dcPh3VT2nkej9EimORCoskGQR6xNjICWI=", "narHash": "sha256-5Xdj6kpXYMie0MlnGwqK5FaMdsedxvyuakWtyKB3zaQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "d01e7280ad7d13a5a0fae57355bd0dbfe5b81969", "rev": "176e455371a8371586e8a3ff0d56ee9f3ca2324e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -98,14 +129,58 @@
"type": "github" "type": "github"
} }
}, },
"nixgl": { "neovim-flake": {
"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-KP+2qdZlhmRkrafuuEofg7YnNdVmGV95ipvpuqmJneI=", "narHash": "sha256-GgIXbuHvwReBHZUyfSKS6DET3CfD6EEKABj6ndpcqHQ=",
"path": "./../../out-of-tree/nixGL", "path": "./../../out-of-tree/nixGL",
"type": "path" "type": "path"
}, },
@ -115,6 +190,22 @@
} }
}, },
"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=",
@ -129,13 +220,13 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1672617983, "lastModified": 1673450908,
"narHash": "sha256-68WDiCBs631mbDDk4UAKdGURKcsfW6hjb7wgudTAe5o=", "narHash": "sha256-b8em+kwrNtnB7gR8SyVf6WuTyQ+6tHS6dzt9D9wgKF0=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", "rev": "6c8644fc37b6e141cbfa6c7dc8d98846c4ff0c2e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -145,7 +236,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1665296151, "lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
@ -167,22 +258,23 @@
"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_2", "nixpkgs": "nixpkgs_3",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1672712534, "lastModified": 1673490397,
"narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=", "narHash": "sha256-VCSmIYJy/ZzTvEGjdfITmTYfybXBgZpMjyjDndbou+8=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f", "rev": "0833f4d063a2bb75aa31680f703ba594a384ffe6",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -18,6 +18,15 @@
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 =
@ -27,10 +36,22 @@
, rust-overlay , rust-overlay
, flake-utils , flake-utils
, kpcli-py , kpcli-py
, neovim-nightly-overlay
, ... , ...
}: }:
let let
system = "x86_64-linux"; # config_fn:: system -> config
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 {
@ -41,10 +62,10 @@
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
@ -56,13 +77,14 @@
inherit overlays pkgs base; inherit overlays pkgs base;
}; };
homeConfigurations = homeConfigurations =
let x11_wsl = '' let
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 ++ [
@ -85,6 +107,14 @@
./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
@ -97,6 +127,25 @@
}; };
}; };
}; };
"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 = [
@ -147,6 +196,7 @@
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 {
@ -161,5 +211,5 @@
}; };
}; };
}; };
}; });
} }

View File

@ -1,31 +1,33 @@
{ {
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, ...}: let outputs = { nixpkgs, from-yaml, ... }:
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 { in
{
inherit nixpkgs; inherit nixpkgs;
inherit from-yaml; inherit from-yaml;
inherit lib; inherit lib;
inherit pkgs; inherit pkgs;
fromYamlFn = lib.fromYaml; fromYamlFn = lib.fromYaml;
yamlCmd = str: (builtins.fromJSON(pkgs.runCommand "echo ${str} | yq")); yamlCmd = str: (builtins.fromJSON (pkgs.runCommand "echo ${str} | yq"));
test_0 = '' test_0 = ''
key_bindings: key_bindings:
- hello: - hello:
"N" "N"
''; '';
key_bind = '' key_bind = ''
key_bindings: key_bindings:
- { key: N, mods: Control, action: CreateNewWindow } - { key: N, mods: Control, action: CreateNewWindow }
# - { key: Paste, action: Paste } # - { key: Paste, action: Paste }
# - { key: Copy, action: Copy } # - { key: Copy, action: Copy }

View File

@ -34,8 +34,8 @@ in
# 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,7 +46,9 @@ in
# pkgs.python310.numpy # pkgs.python310.numpy
# pkgs.python310Packages.tensorflow # pkgs.python310Packages.tensorflow
# pkgs.python310Packages.scikit-learn # pkgs.python310Packages.scikit-learn
] ++ (myHome.packages or [ ]) ] ++ (myHome.packages or [ ]) ++ (if pkgs.system == "x86_64-linux" then [
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

@ -0,0 +1 @@

View File

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

View File

@ -15,13 +15,15 @@ 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

@ -10,7 +10,8 @@ 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

@ -27,10 +27,11 @@
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";
@ -218,9 +219,11 @@
# openCL # openCL
hardware.opengl = { hardware.opengl = {
enable = true; enable = true;
extraPackages = let extraPackages =
let
inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime; inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime;
in [rocm-opencl-icd rocm-opencl-runtime]; in
[ rocm-opencl-icd rocm-opencl-runtime ];
# Vulkan # Vulkan
driSupport = true; driSupport = true;
driSupport32Bit = true; driSupport32Bit = true;
@ -230,17 +233,17 @@
}; };
amd_rx470 = { amd_rx470 = {
# early amd gpu usage # early amd gpu usage
# boot.initrd.kernelModules = ["amdgpu"]; boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.enable = true; services.xserver.enable = true;
services.xserver.videoDrivers = ["amdgpu"]; services.xserver.videoDrivers = [ "amdgpu" ];
}; };
nv_rtx3060 = { nv_rtx3060 = {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
services.xserver.enable = true; services.xserver.enable = true;
services.xserver.videoDrivers = ["nvidia"]; services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
}; };
systemPackages = [] ++ gpu_pkgs; systemPackages = [ ] ++ gpu_pkgs;
in in
lib.recursiveUpdate gpu_conf (lib.recursiveUpdate nv_rtx3060 { lib.recursiveUpdate gpu_conf (lib.recursiveUpdate nv_rtx3060 {
# Use UEFI # Use UEFI
@ -320,7 +323,7 @@
# 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;
}; };

View File

@ -5,7 +5,8 @@
{ {
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" ];
@ -23,13 +24,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,24 +5,27 @@
{ {
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,7 +5,8 @@
{ {
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" ];
@ -23,13 +24,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,7 +5,8 @@
{ {
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" ];
@ -13,7 +14,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;
@ -23,13 +24,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,24 +1,25 @@
{ ## 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 ({
@ -28,8 +29,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;
})) }))

65
out-of-tree/nixGL/fetch.py Executable file
View File

@ -0,0 +1,65 @@
#!/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,12 +8,14 @@
(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 = nixpkgs.legacyPackages.${system}; pkgs = nix_pkgs;
enable32bits = isIntelX86Platform; enable32bits = isIntelX86Platform;
enableIntelX86Extensions = isIntelX86Platform; enableIntelX86Extensions = isIntelX86Platform;
}; };
in rec { in
rec {
packages = { packages = {
# makes it easy to use "nix run nixGL --impure -- program" # makes it easy to use "nix run nixGL --impure -- program"

View File

@ -1,22 +1,42 @@
{ # # Nvidia informations. {
# Version of the system kernel module. Let it to null to enable auto-detection. # # Nvidia informations.
nvidiaVersion ? null, # Version of the system kernel module. Let it to null to enable auto-detection.
# Hash of the Nvidia driver .run file. null is fine, but fixing a value here nvidiaVersion ? null
# will be more reproducible and more efficient. , # Hash of the Nvidia driver .run file. null is fine, but fixing a value here
nvidiaHash ? null, # will be more reproducible and more efficient.
# Alternatively, you can pass a path that points to a nvidia version file nvidiaHash ? null
# and let nixGL extract the version from it. That file must be a copy of , # Alternatively, you can pass a path that points to a nvidia version file
# /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see # and let nixGL extract the version from it. That file must be a copy of
# https://github.com/NixOS/nix/issues/3539 ). # /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see
nvidiaVersionFile ? null, # https://github.com/NixOS/nix/issues/3539 ).
# Enable 32 bits driver nvidiaVersionFile ? null
# This is one by default, you can switch it to off if you want to reduce a , # Enable 32 bits driver
# bit the size of nixGL closure. # This is one by default, you can switch it to off if you want to reduce a
enable32bits ? true # bit the size of nixGL closure.
, writeTextFile, shellcheck, pcre, runCommand, linuxPackages enable32bits ? true
, fetchurl, lib, runtimeShell, bumblebee, libglvnd, vulkan-validation-layers , writeTextFile
, mesa, libvdpau-va-gl, intel-media-driver, vaapiIntel, pkgsi686Linux, driversi686Linux , shellcheck
, zlib, libdrm, xorg, wayland, gcc }: , pcre
, 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 }:
@ -36,55 +56,31 @@ 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 ? null }: rec { nvidiaPackages = { version, sha256 ? fetch_db."${version}".sha256 }:
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 =
let
url = url =
"https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}.run"; "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}.run";
in if sha256 != null then in
fetchurl { inherit url sha256; } fetchurl { inherit url sha256; };
else
builtins.fetchurl url;
useGLVND = true; useGLVND = true;
}); });
nvidiaLibsOnly = nvidiaDrivers.override { nvidiaLibsOnly = nvidiaDrivers.override {
libsOnly = true; libsOnly = true;
kernel = null; kernel = null;
}; };
nixGLNvidiaBumblebee = writeExecutable {
name = "nixGLNvidiaBumblebee-${version}";
text = ''
#!${runtimeShell}
export LD_LIBRARY_PATH=${
lib.makeLibraryPath [ nvidiaDrivers ]
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
${
bumblebee.override {
nvidia_x11 = nvidiaDrivers;
nvidia_x11_i686 = nvidiaDrivers.lib32;
}
}/bin/optirun --ldpath ${
lib.makeLibraryPath ([ libglvnd nvidiaDrivers ]
++ lib.optionals enable32bits [
nvidiaDrivers.lib32
pkgsi686Linux.libglvnd
])
} "$@"
'';
};
# TODO: 32bit version? Not tested.
nixNvidiaWrapper = api: nixNvidiaWrapper = api:
writeExecutable { writeExecutable {
name = "nix${api}Nvidia-${version}"; name = "nix${api}Nvidia-${version}";
@ -119,6 +115,34 @@ let
exec "$@" exec "$@"
''; '';
}; };
in
{
inherit nvidiaDrivers nvidiaLibsOnly;
nixGLNvidiaBumblebee = writeExecutable {
name = "nixGLNvidiaBumblebee-${version}";
text = ''
#!${runtimeShell}
export LD_LIBRARY_PATH=${
lib.makeLibraryPath [ nvidiaDrivers ]
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
${
bumblebee.override {
nvidia_x11 = nvidiaDrivers;
nvidia_x11_i686 = nvidiaDrivers.lib32;
}
}/bin/optirun --ldpath ${
lib.makeLibraryPath ([ libglvnd nvidiaDrivers ]
++ lib.optionals enable32bits [
nvidiaDrivers.lib32
pkgsi686Linux.libglvnd
])
} "$@"
'';
};
# TODO: 32bit version? Not tested.
inherit nixNvidiaWrapper;
# TODO: 32bit version? Not tested. # TODO: 32bit version? Not tested.
nixGLNvidia = nixNvidiaWrapper "GL"; nixGLNvidia = nixNvidiaWrapper "GL";
@ -130,7 +154,8 @@ let
nixGLIntel = writeExecutable { nixGLIntel = writeExecutable {
name = "nixGLIntel"; name = "nixGLIntel";
# add the 32 bits drivers if needed # add the 32 bits drivers if needed
text = let text =
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 ]
@ -138,11 +163,14 @@ let
++ 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 mkdir -p $out/lib
ln -s ${mesa.drivers}/lib/libGLX_mesa.so.0 $out/lib/libGLX_indirect.so.0 ln -s ${mesa.drivers}/lib/libGLX_mesa.so.0 $out/lib/libGLX_indirect.so.0
''); ''
in '' );
in
''
#!${runtimeShell} #!${runtimeShell}
export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" mesa-drivers} export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" mesa-drivers}
export LIBVA_DRIVERS_PATH=${lib.makeSearchPathOutput "out" "lib/dri" intel-driver} export LIBVA_DRIVERS_PATH=${lib.makeSearchPathOutput "out" "lib/dri" intel-driver}
@ -158,7 +186,8 @@ let
nixVulkanIntel = writeExecutable { nixVulkanIntel = writeExecutable {
name = "nixVulkanIntel"; name = "nixVulkanIntel";
text = let text =
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
@ -170,8 +199,10 @@ let
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 '' );
in
''
#!${runtimeShell} #!${runtimeShell}
if [ -n "$LD_LIBRARY_PATH" ]; then if [ -n "$LD_LIBRARY_PATH" ]; then
echo "Warning, nixVulkanIntel overwriting existing LD_LIBRARY_PATH" 1>&2 echo "Warning, nixVulkanIntel overwriting existing LD_LIBRARY_PATH" 1>&2
@ -201,8 +232,10 @@ let
cp ${nixGL}/bin/* "$out/bin/nixGL"; cp ${nixGL}/bin/* "$out/bin/nixGL";
''; '';
auto = let auto =
_nvidiaVersionFile = if nvidiaVersionFile != null then let
_nvidiaVersionFile =
if nvidiaVersionFile != null then
nvidiaVersionFile nvidiaVersionFile
else else
# HACK: Get the version from /proc. It turns out that /proc is mounted # HACK: Get the version from /proc. It turns out that /proc is mounted
@ -210,7 +243,8 @@ let
# #
# builtins.readFile is not able to read /proc files. See # builtins.readFile is not able to read /proc files. See
# https://github.com/NixOS/nix/issues/3539. # https://github.com/NixOS/nix/issues/3539.
runCommand "impure-nvidia-version-file" { runCommand "impure-nvidia-version-file"
{
# To avoid sharing the build result over time or between machine, # To avoid sharing the build result over time or between machine,
# Add an impure parameter to force the rebuild on each access. # Add an impure parameter to force the rebuild on each access.
# time = builtins.currentTime; # time = builtins.currentTime;
@ -220,27 +254,33 @@ let
# 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 = if nvidiaVersion != null then nvidiaVersionAuto =
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 rec { in
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 =
if nvidiaVersionAuto != null then
nixGLCommon autoNvidia.nixGLNvidia nixGLCommon autoNvidia.nixGLNvidia
else else
nixGLCommon nixGLIntel; nixGLCommon nixGLIntel;
} // autoNvidia; } // autoNvidia;
}; };
in top // (if nvidiaVersion != null then in
top.nvidiaPackages { top // (if nvidiaVersion != null then
top.nvidiaPackages
{
version = nvidiaVersion; version = nvidiaVersion;
sha256 = nvidiaHash; sha256 = nvidiaHash;
} }

View File

@ -3,4 +3,5 @@ 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

@ -0,0 +1,570 @@
{
"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,7 +1,24 @@
flake_input@{ kpcli-py, nixgl, rust-overlay, ... }: [ flake_input@{ kpcli-py, nixgl, rust-overlay, neovim-nightly-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
(final: prev:
let
nightlyRustWithExts = exts: final.rust-bin.selectLatestNightlyWith (
toolchain: (toolchain.minimal.override {
extensions = exts;
})
);
# 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? # use python3.9, which works because of cython somehow?
kpcli-py = final.poetry2nix.mkPoetryApplication { kpcli-py = final.poetry2nix.mkPoetryApplication {
projectDir = kpcli-py; projectDir = kpcli-py;
@ -15,6 +32,11 @@ flake_input@{ kpcli-py, nixgl, rust-overlay, ... }: [
); );
}); });
}; };
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}/../nix-conf/system" SYSNIX_DIR="${SCRIPT_DIR}/.."
# Copy hardware-configuration of existing machine onto our version control # Copy hardware-configuration of existing machine onto our version control
SYSNIX_PROF="${SYSNIX_DIR}/profiles/${HOSTNAME}" SYSNIX_PROF="${SYSNIX_DIR}/hosts/${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,15 +7,27 @@ 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 >/dev/null 2>&1) ]; then if [ $(home-manager help >/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,4 +1,5 @@
(import let
inherit ((import
( (
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball { fetchTarball {
@ -7,4 +8,15 @@
} }
) )
{ 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,5 +1,6 @@
# TODO: put ssh keys as user/host config # TODO: put ssh keys as user/host config
inputs: let inputs:
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";
@ -11,7 +12,8 @@ inputs: 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 6pTVLAgOY/JZVWiCFHLo8xQ4/CL6620IMaBRpqI8Wws -> ssh-ed25519 ahbzMg Lx4TLKDZ2yk3DQsM6nOOI1o+FHu0lNtT2p3PBdao+C4
CtJeQuy5VzKZhJnIH+/cjlKsAcg0RY2bhHTWVm+hUOY RsTScUeLmFrO6v1OOxBbyBCMBMVhsGrtu5W9iMOw8B0
-> ssh-ed25519 glsjZQ we7RCgsnODTJ8rKYhU+9tu0DmLH+98mcQKQ3I2slikM -> ssh-ed25519 glsjZQ CdLCkzb1dBoG9gYdMisaZBZT+nnzfOX326CWq6cvN1s
G81lsFLQR9polxme1K/MU2d8Y01PrTqtzJnVq0EMJF0 UKGCxej9lZnLzsuFJnFOMpyrz7YzJrHcrFuDz8l8RQk
-> |-grease B\W,I9z ^Gx;$ Kk7!4,P -> U<J-grease + A6h/F, 'mix
0Jl5Lhx7R8YOs9S+hUtQDDpNIqBhC/MM0N7w1MCtwYtkIIIWKfY9jkJ7+Cew2Ee5 jpEa7b7rRo6bVpTr19c5ALOfaeiP0jldtpQBRWfJnma3VSo3kkDQpfa3RvPjZfD8
Qb04jnE Eg9Zb03MKMUAJnWwfLCXVFQqEVpSaIwI+ujLZ5Cm
--- b7AXWRgK45a/91iwmwt5g+CWOlU/2f4nUDfXlg/bs9A --- /a+J/jeGoWwuNvDEAIGzU0WKx86oH+YRTnSexf+8NP4
¢²%;Þ3RmQÚWhpÌVŠ;º×®¡¥VÍÚñ[zš9al¦±=cLêüva<>ëu7é,†tø±ýUܶh^&å‰Ö¿WåJP6-ÇÒ£ n-ˆ¿=™] !]FµO¬Jv”žó%×-ŻtÚŹŘťuzčB­É˙}ś‡Ő"C\;D (ľ‡ĂFŠÎ®j®ëA7&ąü<C485>˛?é.ć…J•áBa»„ąŽ˛[ŘdXrŢŚO

Binary file not shown.

BIN
secrets/wifi.env.age Normal file

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,10 +3,6 @@
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

@ -0,0 +1,41 @@
# 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

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

View File

@ -1,7 +1,10 @@
(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 = ./.; src = ./.;
}).defaultNix }).defaultNix

View File

@ -25,6 +25,13 @@
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,7 +1,10 @@
(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 = ./.; src = ./.;
}).shellNix }).shellNix

View File

@ -1,7 +1,10 @@
(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 = ./.; src = ./.;
}).defaultNix }).defaultNix

View File

@ -11,22 +11,28 @@
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 = [
(pkgs.rust-bin.selectLatestNightlyWith rust_pkgs
( # rust's compiler is quite powerful enough to the point where
toolchain: # a REPL is not really necessary.
toolchain.default.override { # Rely on the compiler and bacon 99% of the time
extensions = [ "rust-src" ]; # only use REPL if you need to explore/prototype
} # In that case, might as well put the code into sandbox
)) pkgs.evcxr
pkgs.rust-analyzer pkgs.bacon
]; ];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
shellHook = '' shellHook = ''
# nix flake update # is this even needed? # nix flake update # is this even needed?
''; '';

View File

@ -1,7 +1,10 @@
(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 = ./.; src = ./.;
}).shellNix }).shellNix

13
users/default.nix Normal file
View File

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