pull/5/head
pegasust 2023-01-12 23:42:21 -07:00
parent 3a3683baa9
commit 2176df3047
57 changed files with 687 additions and 587 deletions

View File

@ -4,20 +4,21 @@
# Should also incorporate shortcuts like scripts/{hm-switch,conf-sysnix}.sh in here instead
#
# It should not contain PDE
{pkgs? import <nixpkgs> {}
,lib
,...}: pkgs.mkShell {
{ pkgs ? import <nixpkgs> { }
, lib
, ...
}: pkgs.mkShell {
# mkShell doesn't care about the differences across nativeBuildInputs,
# buildInputs, or packages
buildInputs = [
# 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
lol="hello world";
lol = "hello world";
}

View File

@ -123,5 +123,6 @@
debug = {
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
,pkgs, lib, proj_root}: {
}
{ nixpkgs
, agenix
, home-manager
, flake-utils
, nixgl
, rust-overlay
, flake-compat
, pkgs
, lib
, proj_root
}: { }

View File

@ -5,25 +5,28 @@
{
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.kernelModules = [ "amdgpu" ];
boot.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-amd" "coretemp"];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" "coretemp" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
# 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";
};
fileSystems."/boot" =
# Might be wise to use /dev/nvme0p2 instead
{ device = "/dev/disk/by-uuid/EBA6-394D";
{
device = "/dev/disk/by-uuid/EBA6-394D";
fsType = "vfat";
};

View File

@ -1,6 +1,19 @@
{nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
,pkgs, lib, proj_root, nixosDefaultVersion? "22.05", defaultSystem? "x86_64-linux",...}@finalInputs: let
config = {
{ nixpkgs
, agenix
, 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 = {
# req
hostName = "bao";
@ -19,21 +32,23 @@ config = {
(import ../modules/storage.perso.sys.nix)
];
};
};
propagate = hostConfig@{metadata, nixosConfig}: let
};
propagate = hostConfig@{ metadata, nixosConfig }:
let
# req
inherit (metadata) hostName;
# opts
ssh_pubkey = lib.attrByPath ["ssh_pubkey"] null metadata; # metadata.ssh_pubkey??undefined
users = lib.attrByPath ["users"] {} metadata;
nixosVersion = lib.attrByPath ["nixosVersion"] nixosDefaultVersion metadata;
system = lib.attrByPath ["system"] defaultSystem metadata;
preset = lib.attrByPath ["preset"] "base" metadata;
ssh_pubkey = lib.attrByPath [ "ssh_pubkey" ] null metadata; # metadata.ssh_pubkey??undefined
users = lib.attrByPath [ "users" ] { } metadata;
nixosVersion = lib.attrByPath [ "nixosVersion" ] nixosDefaultVersion metadata;
system = lib.attrByPath [ "system" ] defaultSystem metadata;
preset = lib.attrByPath [ "preset" ] "base" metadata;
# infer
hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix";
# alias to prevent infinite recursion
_nixosConfig = nixosConfig;
in {
in
{
inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig;
nixosConfig = _nixosConfig // {
inherit system;
@ -51,25 +66,25 @@ in {
users.users = users;
}
{
imports = [agenix.nixosModule];
environment.systemPackages = [agenix.defaultPackage.x86_64-linux];
imports = [ agenix.nixosModule ];
environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ];
}
(import "${proj_root.modules.path}/secrets.nix")
(import "${proj_root.modules.path}/${preset}.sys.nix")
] ++ _nixosConfig.modules;
};
};
# we are blessed by the fact that we engulfed nixpkgs.lib.* at top level
mkHostFromPropagated = propagatedHostConfig@{nixosConfig,...}: nixpkgs.lib.nixosSystem nixosConfig;
<<<<<<< HEAD
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);
=======
mkHost = hostConfig: (lib.pipe hostConfig [propagate mkHostFromPropagated]);
>>>>>>> 4619ea4 (rekey)
in {
};
# we are blessed by the fact that we engulfed nixpkgs.lib.* at top level
mkHostFromPropagated = propagatedHostConfig@{ nixosConfig, ... }: nixpkgs.lib.nixosSystem nixosConfig;
<<<<<<< HEAD
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);
=======
mkHost = hostConfig: (lib.pipe hostConfig [ propagate mkHostFromPropagated ]);
>>>>>>> 4619ea4 (rekey)
in {
nixosConfigurations = lib.mapAttrs (name: hostConfig: mkHost hostConfig) config;
# {bao = "ssh-ed25519 ..."; another_host = "ssh-rsa ...";}
pubKeys = lib.getPubkey config;
}
}

View File

@ -5,7 +5,8 @@
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
[
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
@ -23,13 +24,13 @@
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/sda";
{
device = "/dev/sda";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/sdb"; }
];
[{ device = "/dev/sdb"; }];
# 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

View File

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

View File

@ -5,7 +5,8 @@
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
[
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
@ -13,7 +14,7 @@
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.kernelParams = ["console=ttyS0,19200n8"];
boot.kernelParams = [ "console=ttyS0,19200n8" ];
boot.loader.grub.extraConfig = ''
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
terminal_input serial;
@ -23,13 +24,13 @@
boot.loader.grub.device = "nodev";
boot.loader.timeout = 10;
fileSystems."/" =
{ device = "/dev/sda";
{
device = "/dev/sda";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/sdb"; }
];
[{ device = "/dev/sdb"; }];
# 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

View File

@ -0,0 +1 @@

View File

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

View File

@ -3,7 +3,7 @@
# TODO: Add to* formats from pkgs.formats.*
{ pkgs
, lib
,...
, ...
} @ inputs:
let
yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage
@ -16,13 +16,15 @@ let
echo "$yamlContent" | yq >$out
'')
{ };
in {
in
{
# 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
fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json"));
fromYamlPath = yamlPath: builtins.fromJSON (
builtins.readFile (
yamlToJsonDrv (
yamlToJsonDrv
(
builtins.readFile yamlPath)
"any-output.json"));
# TODO: fromToml?

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{ pkgs
, my-lib
,...
, ...
}: {
environment.noXlibs = my-lib.mkForce false;
# TODO: wireless networking

View File

@ -1,10 +1,10 @@
{pkgs
,lib
,proj_root
,modulesPath
,...
}:{
imports = ["${modulesPath}/profiles/minimal.nix"];
{ pkgs
, lib
, proj_root
, modulesPath
, ...
}: {
imports = [ "${modulesPath}/profiles/minimal.nix" ];
# prune old builds after a while
nix.settings.auto-optimise-store = true;
nix.package = pkgs.nixFlakes; # nix flakes

View File

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

View File

@ -1,5 +1,5 @@
{config,...}: {
imports = [./gpu.sys.nix];
{ config, ... }: {
imports = [ ./gpu.sys.nix ];
nixpkgs.config.allowUnfree = true;
services.xserver.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];

View File

@ -1,13 +1,15 @@
{config, pkgs, lib}:
let
{ 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
extraPackages =
let
inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime;
in [rocm-opencl-icd rocm-opencl-runtime];
in
[ rocm-opencl-icd rocm-opencl-runtime ];
# Vulkan
driSupport = true;
driSupport32Bit = true;
@ -15,4 +17,5 @@
package32 = pkgs.pkgsi686Linux.mesa.drivers;
};
};
in;
in
;

View File

@ -1,5 +1,6 @@
{proj_root
,...}: {
{ proj_root
, ...
}: {
age.secrets.s3fs = {
file = "${proj_root.secrets.path}/s3fs.age";
# mode = "600"; # owner + group only

View File

@ -1,5 +1,5 @@
# Personal configuration on storage solution
{ pkgs, config, lib,... }: {
{ pkgs, config, lib, ... }: {
environment.systemPackages = [
pkgs.s3fs
pkgs.cifs-utils
@ -70,7 +70,8 @@
bucket = "digital-garden";
})
(
let args = {
let
args = {
"-fstype" = "cifs";
credentials = config.age.secrets._nhitrl_cred.path;
user = null;
@ -79,10 +80,12 @@
dir_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";
credentials = config.age.secrets._nhitrl_cred.path;
user = null;
@ -91,7 +94,8 @@
dir_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);

View File

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

View File

@ -1,4 +1,4 @@
{config,...}: {
{ config, ... }: {
networking.wireless.enable = true;
networking.wireless.environmentFile = config.age.secrets."wifi.env";
networking.wireless.networks = {

View File

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

View File

@ -47,7 +47,7 @@ in
] ++ (if cfg.use_gui or config.base.graphics._enable then [
pkgs.keepass # Personal secret management
] else [ ]);
home.file.".kp/config.ini".text = lib.generators.toINI {} (trimNull {
home.file.".kp/config.ini".text = lib.generators.toINI { } (trimNull {
default = {
KEEPASSDB = cfg.path;
KEEPASSDB_KEYFILE = cfg.keyfile_path;

View File

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

View File

@ -96,9 +96,9 @@ in
# VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true;
# VI_MODE_SET_CURSOR = true;
# ZVM_VI_ESCAPE_BINDKEY = "";
ZVM_READKEY_ENGINE="$ZVM_READKEY_ENGINE_NEX";
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_READKEY_ENGINE = "$ZVM_READKEY_ENGINE_NEX";
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 :)
};
initExtra = (cfg.shellInitExtra or "") + ''
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh

View File

@ -36,7 +36,18 @@
, ...
}:
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;
# pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays;
pkgs = import nixpkgs {
@ -47,10 +58,10 @@
base = import ./base;
inherit (base) mkModuleArgs;
kde_module = {config, pkgs, ...}: {
kde_module = { config, pkgs, ... }: {
fonts.fontconfig.enable = true;
home.packages = [
(pkgs.nerdfonts.override {fonts = ["DroidSansMono"];})
(pkgs.nerdfonts.override { fonts = [ "DroidSansMono" ]; })
];
# For some reasons, Windows es in the font name as DroidSansMono NF
# so we need to override this
@ -62,13 +73,14 @@
inherit overlays pkgs base;
};
homeConfigurations =
let x11_wsl = ''
let
x11_wsl = ''
# x11 output for WSL
export DISPLAY=$(ip route list default | awk '{print $3}'):0
export LIBGL_ALWAYS_INDIRECT=1
'';
in
rec {
{
"hungtr" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = base.modules ++ [
@ -109,6 +121,7 @@
};
};
};
"htran" = home-manager.lib.homeManagerConfiguration { };
"nixos@Felia" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
@ -174,5 +187,5 @@
};
};
};
};
});
}

View File

@ -1,31 +1,33 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
from-yaml ={
from-yaml = {
url = "github:pegasust/fromYaml";
flake = false;
};
};
outputs = {nixpkgs,from-yaml, ...}: let
outputs = { nixpkgs, from-yaml, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
pkgs = import nixpkgs { inherit system; };
lib = {
fromYaml = import "${from-yaml}/fromYaml.nix" {lib = pkgs.lib;};
fromYaml = import "${from-yaml}/fromYaml.nix" { lib = pkgs.lib; };
};
in {
in
{
inherit nixpkgs;
inherit from-yaml;
inherit lib;
inherit pkgs;
fromYamlFn = lib.fromYaml;
yamlCmd = str: (builtins.fromJSON(pkgs.runCommand "echo ${str} | yq"));
yamlCmd = str: (builtins.fromJSON (pkgs.runCommand "echo ${str} | yq"));
test_0 = ''
key_bindings:
- hello:
"N"
'';
key_bind = ''
key_bindings:
key_bindings:
- { key: N, mods: Control, action: CreateNewWindow }
# - { key: Paste, action: Paste }
# - { key: Copy, action: Copy }

View File

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

View File

@ -0,0 +1 @@

View File

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

View File

@ -15,13 +15,15 @@ let
echo "$yamlContent" | yq >$out
'')
{ };
in {
in
{
# 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
fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json"));
fromYamlPath = yamlPath: builtins.fromJSON (
builtins.readFile (
yamlToJsonDrv (
yamlToJsonDrv
(
builtins.readFile yamlPath)
"any-output.json"));
# TODO: fromToml?

View File

@ -10,7 +10,8 @@ let
all = users // systems;
# stands for calculus
c_ = builtins;
in {
in
{
"system/secrets/s3fs.age".publicKeys = c_.attrValues (all);
"system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all);
"system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all);

View File

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

View File

@ -27,10 +27,11 @@
age.secrets._nhitrl_cred = {
file = ./secrets/_nhitrl.age;
};
environment.systemPackages = [agenix.defaultPackage.x86_64-linux];
environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ];
}
];
in {
in
{
# Windows with NixOS WSL
nixosConfigurations.Felia = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
@ -218,9 +219,11 @@
# openCL
hardware.opengl = {
enable = true;
extraPackages = let
extraPackages =
let
inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime;
in [rocm-opencl-icd rocm-opencl-runtime];
in
[ rocm-opencl-icd rocm-opencl-runtime ];
# Vulkan
driSupport = true;
driSupport32Bit = true;
@ -230,17 +233,17 @@
};
amd_rx470 = {
# early amd gpu usage
boot.initrd.kernelModules = ["amdgpu"];
boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.enable = true;
services.xserver.videoDrivers = ["amdgpu"];
services.xserver.videoDrivers = [ "amdgpu" ];
};
nv_rtx3060 = {
nixpkgs.config.allowUnfree = true;
services.xserver.enable = true;
services.xserver.videoDrivers = ["nvidia"];
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
};
systemPackages = [] ++ gpu_pkgs;
systemPackages = [ ] ++ gpu_pkgs;
in
lib.recursiveUpdate gpu_conf (lib.recursiveUpdate nv_rtx3060 {
# Use UEFI
@ -320,7 +323,7 @@
# Just an initial user to get this started lol
users.users.user = {
initialPassword = "pw123";
extraGroups = [ "wheel" "networkmanager" "audio"];
extraGroups = [ "wheel" "networkmanager" "audio" ];
isNormalUser = true;
};

View File

@ -5,7 +5,8 @@
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
[
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
@ -23,13 +24,13 @@
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/sda";
{
device = "/dev/sda";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/sdb"; }
];
[{ device = "/dev/sdb"; }];
# 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

View File

@ -5,24 +5,27 @@
{
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.kernelModules = [ "amdgpu" ];
boot.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-amd" "coretemp"];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" "coretemp" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
# 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";
};
fileSystems."/boot" =
# Might be wise to use /dev/nvme0p2 instead
{ device = "/dev/disk/by-uuid/EBA6-394D";
{
device = "/dev/disk/by-uuid/EBA6-394D";
fsType = "vfat";
};

View File

@ -5,7 +5,8 @@
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
[
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
@ -23,13 +24,13 @@
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/sda";
{
device = "/dev/sda";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/sdb"; }
];
[{ device = "/dev/sdb"; }];
# 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

View File

@ -5,7 +5,8 @@
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
[
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
@ -13,7 +14,7 @@
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.kernelParams = ["console=ttyS0,19200n8"];
boot.kernelParams = [ "console=ttyS0,19200n8" ];
boot.loader.grub.extraConfig = ''
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
terminal_input serial;
@ -23,13 +24,13 @@
boot.loader.grub.device = "nodev";
boot.loader.timeout = 10;
fileSystems."/" =
{ device = "/dev/sda";
{
device = "/dev/sda";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/sdb"; }
];
[{ device = "/dev/sdb"; }];
# 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

View File

@ -20,6 +20,6 @@ let
'';
});
in
(with pure; [nixGLIntel nixVulkanNvidia nixGLNvidia nixVulkanIntel])
++ (with versionFile440.auto; [nixGLNvidia nixGLDefault nixVulkanNvidia])
++ (with versionFile510.auto; [nixGLNvidia nixGLDefault nixVulkanNvidia])
(with pure; [ nixGLIntel nixVulkanNvidia nixGLNvidia nixVulkanIntel ])
++ (with versionFile440.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.
nvidiaVersion ? null,
# Hash of the Nvidia driver .run file. null is fine, but fixing a value here
nvidiaVersion ? null
, # Hash of the Nvidia driver .run file. null is fine, but fixing a value here
# will be more reproducible and more efficient.
nvidiaHash ? null,
# Alternatively, you can pass a path that points to a nvidia version file
nvidiaHash ? null
, # 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
# /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see
# https://github.com/NixOS/nix/issues/3539 ).
nvidiaVersionFile ? null,
# Enable 32 bits driver
nvidiaVersionFile ? null
, # Enable 32 bits driver
# This is on by default, you can switch it to off if you want to reduce a
# bit the size of nixGL closure.
enable32bits ? true,
# Make sure to enable config.allowUnfree to the instance of nixpkgs to be
enable32bits ? true
, # Make sure to enable config.allowUnfree to the instance of nixpkgs to be
# able to access the nvidia drivers.
pkgs ? import <nixpkgs> {
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
}:
pkgs.callPackage ./nixGL.nix ({
@ -28,8 +29,8 @@ pkgs.callPackage ./nixGL.nix ({
nvidiaHash
enable32bits
;
} // (if enableIntelX86Extensions then {}
else {
} // (if enableIntelX86Extensions then { }
else {
intel-media-driver = null;
vaapiIntel = null;
}))
}))

View File

@ -8,13 +8,14 @@
(flake-utils.lib.eachDefaultSystem (system:
let
isIntelX86Platform = system == "x86_64-linux";
nix_pkgs = import nixpkgs {inherit system;};
nix_pkgs = import nixpkgs { inherit system; };
pkgs = import ./default.nix {
pkgs = nix_pkgs;
enable32bits = isIntelX86Platform;
enableIntelX86Extensions = isIntelX86Platform;
};
in rec {
in
rec {
packages = {
# makes it easy to use "nix run nixGL --impure -- program"

View File

@ -62,7 +62,7 @@ let
It contains the builder for different nvidia configuration, parametrized by
the version of the driver and sha256 sum of the driver installer file.
*/
nvidiaPackages = { version, sha256? fetch_db."${version}".sha256 }:
nvidiaPackages = { version, sha256 ? fetch_db."${version}".sha256 }:
let
nvidiaDrivers = (linuxPackages.nvidia_x11.override { }).overrideAttrs
(oldAttrs: {

View File

@ -13,7 +13,8 @@ let
inherit (pubKeys) users hosts;
all = users // hosts;
c_ = builtins;
in {
in
{
"secrets/s3fs.age".publicKeys = c_.attrValues (all);
"secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all);
"secrets/_nhitrl.age".publicKeys = c_.attrValues (all);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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