mirror of
https://github.com/ellmau/nixos.git
synced 2025-12-19 09:29:36 +01:00
First redesign commit
lib originates from Max Co-authored-by: Maximilan Marx <maximilian.marx@tu-dresden.de>
This commit is contained in:
parent
25d4578730
commit
2d056162d6
112
flake.lock
generated
112
flake.lock
generated
@ -39,6 +39,29 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dwarffs": {
|
||||
"inputs": {
|
||||
"nix": [
|
||||
"nix"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1646560263,
|
||||
"narHash": "sha256-VYJFoEigK0DASnBiYUhQBe0c0O4mlcoGBlYN8qs2TOo=",
|
||||
"owner": "edolstra",
|
||||
"repo": "dwarffs",
|
||||
"rev": "e768ce3239156de05f7ff3210d86a80762730f30",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "dwarffs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"emacs-overlay": {
|
||||
"locked": {
|
||||
"lastModified": 1651750171,
|
||||
@ -70,6 +93,39 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1644229661,
|
||||
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils-plus": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1647259887,
|
||||
"narHash": "sha256-yEkMbEHVO9qydluQ3uHGWX1PkfZhgDKxnd1rhZYZ72w=",
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"rev": "06dba5f3b4fa2cc0bfc98ce9cd6f9a4d8db11d46",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@ -91,6 +147,22 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"lowdown-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1633514407,
|
||||
"narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
|
||||
"owner": "kristapsdz",
|
||||
"repo": "lowdown",
|
||||
"rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kristapsdz",
|
||||
"repo": "lowdown",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
@ -110,6 +182,28 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix": {
|
||||
"inputs": {
|
||||
"lowdown-src": "lowdown-src",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-regression": "nixpkgs-regression"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1651760216,
|
||||
"narHash": "sha256-g3GDM8MSzJ27hJoGWj2QGjINZP/I1KCJpZZn+iPMmfM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nix",
|
||||
"rev": "f4102de84ba4dd3b845a3e34fabab5400e066ad0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1650522846,
|
||||
@ -169,6 +263,21 @@
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs-regression": {
|
||||
"locked": {
|
||||
"lastModified": 1643052045,
|
||||
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1651558728,
|
||||
@ -219,8 +328,11 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"comma": "comma",
|
||||
"dwarffs": "dwarffs",
|
||||
"emacs-overlay": "emacs-overlay",
|
||||
"flake-utils-plus": "flake-utils-plus",
|
||||
"home-manager": "home-manager",
|
||||
"nix": "nix",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
|
||||
90
flake.nix
90
flake.nix
@ -1,11 +1,16 @@
|
||||
{
|
||||
description = "Flake to generate NixOS configurations";
|
||||
description = "Flake to define configurations of 'elss' - ellmauthaler stefan's systems";
|
||||
|
||||
inputs = {
|
||||
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
nix = {
|
||||
url = "github:NixOS/nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nixos-hardware = {
|
||||
url = "github:NixOS/nixos-hardware/master";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
@ -21,8 +26,14 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
flake-utils-plus = {
|
||||
url = "github:gytis-ivaskevicius/flake-utils-plus";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
emacs-overlay = {
|
||||
url = "github:nix-community/emacs-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-21.11";
|
||||
@ -31,16 +42,75 @@
|
||||
url = "github:Mic92/sops-nix/master";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
dwarffs = {
|
||||
url = "github:edolstra/dwarffs";
|
||||
inputs = {
|
||||
nix.follows = "nix";
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {self, ...}@inputs:
|
||||
let outputs = rec {
|
||||
overlay = import ./local-overlay;
|
||||
nixosConfigurations = import self {
|
||||
flakes = inputs;
|
||||
flakeOutputs = outputs;
|
||||
};
|
||||
nixosModules = {};
|
||||
outputs = {self, nixpkgs, flake-utils-plus, ...}@inputs:
|
||||
let
|
||||
extended-lib = nixpkgs.lib.extend
|
||||
(final: prev: {
|
||||
elss = (import ./lib {lib = final; }) prev;
|
||||
});
|
||||
inherit (extended-lib.elss) discoverModules moduleNames;
|
||||
in
|
||||
flake-utils-plus.lib.mkFlake rec{
|
||||
inherit self inputs;
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
|
||||
lib = extended-lib;
|
||||
|
||||
channelsConfig = {
|
||||
allowUnfreePredicate = pkg: builtins.elem (extended-lib.getName pkg) [
|
||||
"steam"
|
||||
"steam-original"
|
||||
"steam-runtime"
|
||||
"skypeforlinux"
|
||||
"teams"
|
||||
"zoom"
|
||||
];
|
||||
};
|
||||
in outputs;
|
||||
|
||||
channels.nixpkgs.overlaysBuilder = channels: [
|
||||
(final: prev: {
|
||||
unstable = channels.nixpkgs-unstable;
|
||||
})
|
||||
inputs.nix.overlay
|
||||
inputs.emacs-overlay.overlay
|
||||
];
|
||||
|
||||
hostDefaults = {
|
||||
system = "x86_64-linux";
|
||||
channelName = "nixpkgs";
|
||||
modules = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.dwarffs.nixosModules.dwarffs
|
||||
] ++ (map (name: ./modules + "/${name}") (moduleNames ./modules));
|
||||
extraArgs = { inherit inputs homeConfigurations; };
|
||||
};
|
||||
|
||||
hosts = discoverModules ./machines (name: {
|
||||
modules = [ (./machines + "/${name}") ];
|
||||
specialArgs = { lib = extended-lib; };
|
||||
});
|
||||
|
||||
homeConfigurations = discoverModules ./users
|
||||
(name:
|
||||
let
|
||||
username = extended-lib.removeSuffix ".nix" name;
|
||||
in
|
||||
inputs.home-manager.lib.homeManagerConfiguration {
|
||||
configuration = import (./users + "/${name}");
|
||||
inherit username;
|
||||
system = "x86_64-linux";
|
||||
homeDirectory = "/home/${username}";
|
||||
stateVersion = "21.11";
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
6
lib/default.nix
Normal file
6
lib/default.nix
Normal file
@ -0,0 +1,6 @@
|
||||
{ lib }:
|
||||
|
||||
(lib.composeManyExtensions [
|
||||
(import ./users.nix)
|
||||
(import ./files.nix)
|
||||
]) lib
|
||||
14
lib/files.nix
Normal file
14
lib/files.nix
Normal file
@ -0,0 +1,14 @@
|
||||
final: prev:
|
||||
|
||||
with prev; rec {
|
||||
moduleNames = dir: pipe dir [
|
||||
builtins.readDir
|
||||
(filterAttrs (name: type: !hasPrefix "." name && (hasSuffix ".nix" name || type == "directory")))
|
||||
attrNames
|
||||
];
|
||||
discoverModules = dir: f:
|
||||
listToAttrs (map
|
||||
(filename:
|
||||
nameValuePair (removeSuffix ".nix" filename) (f filename))
|
||||
(moduleNames dir));
|
||||
}
|
||||
19
lib/users.nix
Normal file
19
lib/users.nix
Normal file
@ -0,0 +1,19 @@
|
||||
final: prev:
|
||||
|
||||
{
|
||||
withConfig = config:
|
||||
|
||||
let
|
||||
cfg = config.elss.users;
|
||||
mapAccount = f: login: prev.nameValuePair login (f login);
|
||||
mapList = f: lst: builtins.listToAttrs (map (mapAccount f) lst);
|
||||
in
|
||||
rec {
|
||||
mapUsers = f: mapList f cfg.users;
|
||||
mapAdmins = f: mapList f cfg.admins;
|
||||
mapAllUsers = f: (mapUsers f) // (mapAdmins f);
|
||||
mapAllUsersAndRoot = f: (mapAllUsers f) // {
|
||||
root = f "root";
|
||||
};
|
||||
};
|
||||
}
|
||||
30
machines/stel-xps/default.nix
Normal file
30
machines/stel-xps/default.nix
Normal file
@ -0,0 +1,30 @@
|
||||
{ config, pkgs, ...}:
|
||||
{
|
||||
imports = [ ./printer.nix ];
|
||||
|
||||
variables = {
|
||||
hostName = "stel-xps";
|
||||
graphical = true;
|
||||
git = {
|
||||
key = "0x4998BEEE";
|
||||
gpgsm = true;
|
||||
signDefault = true;
|
||||
};
|
||||
};
|
||||
#networking.hostName = "stel-xps"; # define the hostname
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
brightnessctl
|
||||
];
|
||||
|
||||
boot.extraModulePackages = [
|
||||
config.boot.kernelPackages.v4l2loopback
|
||||
];
|
||||
|
||||
boot.kernelModules = [
|
||||
"v4l2loopback"
|
||||
];
|
||||
|
||||
services.autorandr.enable = true;
|
||||
services.xserver.desktopManager.wallpaper.mode = "fill";
|
||||
}
|
||||
35
machines/stel-xps/hardware-configuration.nix
Normal file
35
machines/stel-xps/hardware-configuration.nix
Normal file
@ -0,0 +1,35 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/6b7f9f80-af34-4317-b017-f883a2316674";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices."crypted".device = "/dev/disk/by-uuid/9c84f143-023d-4fcb-a49c-ca78ce69e0e0";
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/4824-2CFD";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/93381a25-6704-408e-b091-cfda6cddbda0"; }
|
||||
];
|
||||
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
# high-resolution display
|
||||
hardware.video.hidpi.enable = lib.mkDefault true;
|
||||
}
|
||||
3056
machines/stel-xps/ppds/Ricoh/ricoh-mp-c307.ppd
Normal file
3056
machines/stel-xps/ppds/Ricoh/ricoh-mp-c307.ppd
Normal file
File diff suppressed because it is too large
Load Diff
1832
machines/stel-xps/ppds/Ricoh/ricoh-sp-4510dn.ppd
Normal file
1832
machines/stel-xps/ppds/Ricoh/ricoh-sp-4510dn.ppd
Normal file
File diff suppressed because it is too large
Load Diff
87
machines/stel-xps/printer.nix
Normal file
87
machines/stel-xps/printer.nix
Normal file
@ -0,0 +1,87 @@
|
||||
{ config, pkgs, ...}:
|
||||
|
||||
let
|
||||
ppd-local = pkgs.stdenv.mkDerivation rec {
|
||||
pname = "local-ppds";
|
||||
version = "2021-07-04";
|
||||
|
||||
src = ./ppds;
|
||||
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/cups/model/
|
||||
cp -R Ricoh $out/share/cups/model
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
services.printing.drivers = with pkgs; [
|
||||
foomatic-filters
|
||||
gutenprint
|
||||
hplip
|
||||
] ++ [
|
||||
ppd-local
|
||||
];
|
||||
|
||||
hardware.printers.ensurePrinters = [
|
||||
{
|
||||
name = "hpm605";
|
||||
location = "APB/3014";
|
||||
description = "HP Laserjet Enterprise M605DN";
|
||||
deviceUri = "hp:/net/HP_LaserJet_M605?hostname=hpm605.tcs.inf.tu-dresden.de";
|
||||
model = "HP/hp-laserjet_m604_m605_m606-ps.ppd.gz";
|
||||
ppdOptions = {
|
||||
Collate = "True";
|
||||
HPOption_Duplexer = "True";
|
||||
HPOption_Tray4 = "HP500SheetInputTray";
|
||||
HPOption_Tray3 = "HP500SheetInputTray";
|
||||
MediaType = "Recycled";
|
||||
Duplex = "DuplexNoTumble";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "A4";
|
||||
location = "APB/3014";
|
||||
description = "HP Laserjet 9040";
|
||||
deviceUri = "socket://a4.tcs.inf.tu-dresden.de";
|
||||
model = "HP/hp-laserjet_9040-ps.ppd.gz";
|
||||
ppdOptions = {
|
||||
PageSize = "A4";
|
||||
HPOption_Tray1 = "True";
|
||||
HPOption_Duplexer = "True";
|
||||
InstalledMemory = "128-255MB";
|
||||
MediaType = "Plain";
|
||||
Duplex = "DuplexNoTumble";
|
||||
Collate = "True";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "ricoh";
|
||||
location = "APB/3014";
|
||||
description = "Ricoh SP 4510DN";
|
||||
deviceUri = "socket://ricoh.tcs.inf.tu-dresden.de";
|
||||
model = "Ricoh/ricoh-sp-4510dn.ppd";
|
||||
ppdOptions = {
|
||||
OptionTray = "2Cassette";
|
||||
PageSize = "A4";
|
||||
InputSlot = "3Tray";
|
||||
Duplex = "none";
|
||||
RIPaperPolicy = "NearestSizeAdjust";
|
||||
pdftops-render-default = "pdftocairo";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "ricohcolor";
|
||||
location = "APB/3014";
|
||||
description = "Ricoh Alficio MP C307";
|
||||
deviceUri = "socket://color.tcs.inf.tu-dresden.de";
|
||||
model = "Ricoh/ricoh-mp-c307.ppd";
|
||||
ppdOptions = {
|
||||
media = "A4";
|
||||
OptionTray = "1Cassette";
|
||||
RIPostScript = "Adobe";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
31
modules/nix.nix
Normal file
31
modules/nix.nix
Normal file
@ -0,0 +1,31 @@
|
||||
{ pkgs, config, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
nix = {
|
||||
useSandbox = true;
|
||||
package = pkgs.nixFlakes;
|
||||
generateRegistryFromInputs = true;
|
||||
generateNixPathFromInputs = true;
|
||||
linkInputs = true;
|
||||
|
||||
autoOptimiseStore = true;
|
||||
trustedUsers = [ "root" ] ++ config.elss.users.admins;
|
||||
|
||||
# Enable flakes
|
||||
# Free up to 50 GiB whenever there is less than 10 GiB left.
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
min-free = ${toString (10 * 1024 * 1024 * 1024)}
|
||||
max-free = ${toString (50 * 1024 * 1024 * 1024)}
|
||||
'';
|
||||
|
||||
# Disable automatic (periodic) GC, since it might interfere with benchmarks
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user