Compare commits

..

8 commits

Author SHA1 Message Date
b32f7e3989
properly handle rune module 2024-05-06 15:49:11 -05:00
86bc2bf44f
don't lose error info on oizys dry 2024-05-06 15:34:14 -05:00
bb87af5136
completely rework rune system 2024-05-06 15:30:10 -05:00
ee519f94c9
nixfmt-rfc-style now 2024-05-06 14:32:00 -05:00
9174ac3198
hide helpLine 2024-05-06 14:29:29 -05:00
dca2c93a69
add spinner to oizys 2024-05-06 12:21:45 -05:00
aa91eb9a8f
flake.lock: Update
Flake lock file updates:

• Updated input 'hyprland':
    'git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=cddeec47a1fc0e70d8598fd10c29cd0e9489999f&submodules=1' (2024-05-05)
  → 'git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=fa69de8ab6cc17bb763a1586c55847c5d5a82a83&submodules=1' (2024-05-06)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/d32560238207b8e26d88b265207b216ee46b8450?narHash=sha256-hfBmnYFyz9I1mdrC3tX1A%2BdF9cOUcds5PIMPxrT%2BcRk%3D' (2024-05-04)
  → 'github:nixos/nixpkgs/ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d?narHash=sha256-clkcOIkg8G4xuJh%2B1onLG4HPMpbtzdLv4rHxFzgsH9c%3D' (2024-05-05)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/eb44cc5dcc75c33e7f246c9f38b96f158b3f6e9d?narHash=sha256-LbSVziNYk/nxfYeyxKNhV/ryfbCUUZVlWoG5KG0sOxk%3D' (2024-05-05)
  → 'github:nix-community/nixpkgs-wayland/05dbf637618396834607a9844660e2bf85f3051c?narHash=sha256-4gtiHlHDC9P7/%2BcXNYVVTKLNN7v0ltJ1HIgYhX8c1wk%3D' (2024-05-06)
• Updated input 'zig2nix':
    'github:Cloudef/zig2nix/deb76120bc98822cfa66c33778562214479eb050?narHash=sha256-HDtmvjUjWVq%2BEIvem2rwRrGhR13KYqCQKq5xSm3mP%2B8%3D' (2024-05-05)
  → 'github:Cloudef/zig2nix/362cc6f3fe27d73f3663d8c2c25f23ca75151ed6?narHash=sha256-Xn8hziZWSuNGscMKNdBhrHUhfH3NZC9m0oIKwCcCYtg%3D' (2024-05-06)
2024-05-06 11:58:40 -05:00
227e3a2fe9
update oizys help on README 2024-05-05 17:42:09 -05:00
56 changed files with 506 additions and 364 deletions

View file

@ -42,21 +42,26 @@ nix run "github:daylinmorgan/oizys"
``` ```
``` ```
oizys <cmd> [opts] nix begat oizys
commands: Usage:
dry poor man's nix flake check oizys [command]
boot nixos-rebuild boot
switch nixos-rebuild switch Available Commands:
boot nixos rebuild boot
build A brief description of your command
cache build and push to cachix cache build and push to cachix
build build system flake dry poor man's nix flake check
help Help about any command
output show nixosConfiguration attr
switch nixos rebuild switch
options: Flags:
-h|--help show this help --flake string path to flake ($OIZYS_DIR or $HOME/oizys)
--host hostname (current host) -h, --help help for oizys
-f|--flake path to flake ($FLAKE_PATH or $HOME/oizys) --host string host to build (current host)
-c|--cache name of cachix binary cache (daylin)
--no-pinix don't use pinix Use "oizys [command] --help" for more information about a command.
``` ```
## oizys? ## oizys?

View file

@ -200,11 +200,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1714933694, "lastModified": 1715012366,
"narHash": "sha256-gziEBZF1wmBBw3v0Ang3nN3QwoQWtFmBIORODJt38TE=", "narHash": "sha256-+e9u2a92M3CIdnjMxqbJS0ulxkjXaRwHGIJR+fyhZII=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "cddeec47a1fc0e70d8598fd10c29cd0e9489999f", "rev": "fa69de8ab6cc17bb763a1586c55847c5d5a82a83",
"revCount": 4617, "revCount": 4620,
"submodules": true, "submodules": true,
"type": "git", "type": "git",
"url": "https://github.com/hyprwm/Hyprland" "url": "https://github.com/hyprwm/Hyprland"
@ -443,11 +443,11 @@
"nixpkgs": "nixpkgs_6" "nixpkgs": "nixpkgs_6"
}, },
"locked": { "locked": {
"lastModified": 1714926024, "lastModified": 1715004883,
"narHash": "sha256-LbSVziNYk/nxfYeyxKNhV/ryfbCUUZVlWoG5KG0sOxk=", "narHash": "sha256-4gtiHlHDC9P7/+cXNYVVTKLNN7v0ltJ1HIgYhX8c1wk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs-wayland", "repo": "nixpkgs-wayland",
"rev": "eb44cc5dcc75c33e7f246c9f38b96f158b3f6e9d", "rev": "05dbf637618396834607a9844660e2bf85f3051c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -490,11 +490,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1714809261, "lastModified": 1714912032,
"narHash": "sha256-hfBmnYFyz9I1mdrC3tX1A+dF9cOUcds5PIMPxrT+cRk=", "narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d32560238207b8e26d88b265207b216ee46b8450", "rev": "ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -752,11 +752,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1714871906, "lastModified": 1714958137,
"narHash": "sha256-HDtmvjUjWVq+EIvem2rwRrGhR13KYqCQKq5xSm3mP+8=", "narHash": "sha256-Xn8hziZWSuNGscMKNdBhrHUhfH3NZC9m0oIKwCcCYtg=",
"owner": "Cloudef", "owner": "Cloudef",
"repo": "zig2nix", "repo": "zig2nix",
"rev": "deb76120bc98822cfa66c33778562214479eb050", "rev": "362cc6f3fe27d73f3663d8c2c25f23ca75151ed6",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -3,10 +3,9 @@
pkgs, pkgs,
enabled, enabled,
... ...
}: { }:
imports = with self.nixosModules; [ {
restic imports = with self.nixosModules; [ restic ];
];
oizys = { oizys = {
languages = [ languages = [
@ -14,6 +13,7 @@
"node" # for docker langservers "node" # for docker langservers
"python" "python"
]; ];
rune.motd = enabled;
docker = enabled; docker = enabled;
backups = enabled; backups = enabled;
@ -31,7 +31,11 @@
rcloneConfigFile = "/home/daylin/.config/rclone/rclone.conf"; rcloneConfigFile = "/home/daylin/.config/rclone/rclone.conf";
repository = "rclone:g:archives/algiz"; repository = "rclone:g:archives/algiz";
passwordFile = "/home/daylin/.config/restic/algiz-pass"; passwordFile = "/home/daylin/.config/restic/algiz-pass";
paths = ["/home/daylin/services/git/" "/home/daylin/services/gotosocial/" "home/daylin/services/caddy"]; paths = [
"/home/daylin/services/git/"
"/home/daylin/services/gotosocial/"
"home/daylin/services/caddy"
];
}; };
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;

View file

@ -1,16 +1,18 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ lib, modulesPath, ... }:
{ {
lib, imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
modulesPath,
...
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; boot.initrd.availableKernelModules = [
"ahci"
"xhci_pci"
"virtio_pci"
"virtio_scsi"
"sd_mod"
"sr_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@ -20,9 +22,7 @@
fsType = "ext4"; fsType = "ext4";
}; };
swapDevices = [ swapDevices = [ { device = "/dev/disk/by-uuid/a4e4cad9-1844-45dd-9bea-eb77bd71c37b"; } ];
{device = "/dev/disk/by-uuid/a4e4cad9-1844-45dd-9bea-eb77bd71c37b";}
];
# 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,13 +1,5 @@
{ enabled, ... }:
{ {
lib,
enabled,
...
}: {
users.motd = lib.mkRune {
number = "6";
rune = "algiz";
};
services.resolved = enabled; services.resolved = enabled;
services.fail2ban = { services.fail2ban = {
@ -23,15 +15,16 @@
# networking.nameservers = [ "8.8.8.8"]; # networking.nameservers = [ "8.8.8.8"];
# allow tcp connections for revsere proxy # allow tcp connections for revsere proxy
networking.firewall = networking.firewall = enabled // {
enabled allowedTCPPorts = [
// { 80
allowedTCPPorts = [80 443]; 443
];
}; };
services.openssh = services.openssh = enabled // {
enabled settings.PasswordAuthentication = false;
// {settings.PasswordAuthentication = false;}; };
# users.mutableUsers = false; # users.mutableUsers = false;

View file

@ -1,15 +1,11 @@
{ self, enabled, ... }:
{ {
self, imports = with self.nixosModules; [ nix-ld ];
enabled,
...
}: {
imports = with self.nixosModules; [
nix-ld
];
oizys = { oizys = {
desktop = enabled; desktop = enabled;
nix-ld = enabled; nix-ld = enabled;
rune.motd = enabled;
}; };
# Enable the X11 windowing system. # Enable the X11 windowing system.

View file

@ -6,14 +6,23 @@
lib, lib,
modulesPath, modulesPath,
... ...
}: { }:
imports = [ {
(modulesPath + "/installer/scan/not-detected.nix") imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = ["kvm-amd" "wl"]; boot.kernelModules = [
"kvm-amd"
"wl"
];
boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
fileSystems."/" = { fileSystems."/" = {
@ -26,9 +35,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ swapDevices = [ { device = "/dev/disk/by-uuid/115bc13a-9b09-4790-986c-ab3b434cde69"; } ];
{device = "/dev/disk/by-uuid/115bc13a-9b09-4790-986c-ab3b434cde69";}
];
# 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

@ -2,14 +2,9 @@
config, config,
pkgs, pkgs,
enabled, enabled,
mkRune,
... ...
}: { }:
users.motd = mkRune { {
number = "2";
rune = "mannaz";
};
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader = { boot.loader = {
systemd-boot = enabled; systemd-boot = enabled;
@ -27,14 +22,10 @@
} }
]; ];
hardware.opengl = hardware.opengl = enabled // {
enabled
// {
driSupport = true; driSupport = true;
driSupport32Bit = true; driSupport32Bit = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [ libGL ];
libGL
];
setLdLibraryPath = true; setLdLibraryPath = true;
}; };
# Load nvidia driver for Xorg and Wayland # Load nvidia driver for Xorg and Wayland
@ -45,9 +36,7 @@
modesetting = enabled; modesetting = enabled;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail. # Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement = powerManagement = enabled // {
enabled
// {
# Fine-grained power management. Turns off GPU when not in use. # Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer). # Experimental and only works on modern Nvidia GPUs (Turing or newer).
finegrained = false; finegrained = false;

View file

@ -1,8 +1,5 @@
{ pkgs, enabled, ... }:
{ {
pkgs,
enabled,
...
}: {
oizys = { oizys = {
desktop = enabled; desktop = enabled;
hyprland = enabled; hyprland = enabled;
@ -31,7 +28,10 @@
user = "daylin"; user = "daylin";
repository = "rclone:g:archives/othalan"; repository = "rclone:g:archives/othalan";
passwordFile = "/home/daylin/.config/restic/othalan-pass"; passwordFile = "/home/daylin/.config/restic/othalan-pass";
paths = ["/home/daylin/stuff/" "/home/daylin/dev/"]; paths = [
"/home/daylin/stuff/"
"/home/daylin/dev/"
];
}; };
users.users.daylin.extraGroups = [ users.users.daylin.extraGroups = [

View file

@ -6,12 +6,17 @@
lib, lib,
modulesPath, modulesPath,
... ...
}: { }:
imports = [ {
(modulesPath + "/installer/scan/not-detected.nix") imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
];
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@ -26,9 +31,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ swapDevices = [ { device = "/dev/disk/by-uuid/bd64a1ba-f259-4b64-88cd-5585b9345f5a"; } ];
{device = "/dev/disk/by-uuid/bd64a1ba-f259-4b64-88cd-5585b9345f5a";}
];
# 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,6 +1,8 @@
{pkgs, ...}: let { pkgs, ... }:
let
notes-git = ''${pkgs.git}/bin/git -C /home/daylin/stuff/notes''; notes-git = ''${pkgs.git}/bin/git -C /home/daylin/stuff/notes'';
in { in
{
systemd.services.notes-bot = { systemd.services.notes-bot = {
description = "auto commit changes to notes"; description = "auto commit changes to notes";
serviceConfig = { serviceConfig = {

View file

@ -1,13 +1,11 @@
{ pkgs, enabled, ... }:
{ {
pkgs,
enabled,
mkRune,
...
}: {
networking.networkmanager = enabled; networking.networkmanager = enabled;
services.printing = enabled; services.printing = enabled;
services.fwupd = enabled; services.fwupd = enabled;
hardware.bluetooth = enabled // {powerOnBoot = true;}; hardware.bluetooth = enabled // {
powerOnBoot = true;
};
# https://github.com/NixOS/nixos-hardware/blob/c478b3d56969006e015e55aaece4931f3600c1b2/lenovo/thinkpad/x1/9th-gen/default.nix # https://github.com/NixOS/nixos-hardware/blob/c478b3d56969006e015e55aaece4931f3600c1b2/lenovo/thinkpad/x1/9th-gen/default.nix
# https://github.com/NixOS/nixos-hardware/blob/c478b3d56969006e015e55aaece4931f3600c1b2/common/pc/ssd/default.nix # https://github.com/NixOS/nixos-hardware/blob/c478b3d56969006e015e55aaece4931f3600c1b2/common/pc/ssd/default.nix
@ -15,22 +13,15 @@
# rtkit is optional but recommended # rtkit is optional but recommended
security.rtkit = enabled; security.rtkit = enabled;
services.pipewire = services.pipewire = enabled // {
enabled
// {
audio = enabled; audio = enabled;
pulse = enabled; pulse = enabled;
alsa = enabled // {support32Bit = true;}; alsa = enabled // {
support32Bit = true;
};
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ pamixer ];
pamixer
];
services.getty.greetingLine = mkRune {
rune = "othalan";
runeKind = "ascii";
};
networking.hostName = "othalan"; networking.hostName = "othalan";
time.timeZone = "US/Central"; time.timeZone = "US/Central";
@ -45,9 +36,7 @@
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest; boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
boot.loader = { boot.loader = {
systemd-boot = systemd-boot = enabled // {
enabled
// {
consoleMode = "max"; consoleMode = "max";
}; };
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;

View file

@ -1,57 +1,76 @@
inputs: let inputs:
let
inherit (inputs) nixpkgs self; inherit (inputs) nixpkgs self;
lib = nixpkgs.lib.extend (import ./extended.nix); lib = nixpkgs.lib.extend (import ./extended.nix);
inherit (builtins) mapAttrs readDir filter listToAttrs; inherit (builtins)
inherit (lib) nixosSystem genAttrs isNixFile mkDefaultOizysModule mkOizysModule enabled mkRune; mapAttrs
readDir
filter
listToAttrs
;
inherit (lib)
nixosSystem
genAttrs
isNixFile
mkDefaultOizysModule
mkOizysModule
enabled
;
inherit (lib.filesystem) listFilesRecursive; inherit (lib.filesystem) listFilesRecursive;
inherit (import ./find-modules.nix { inherit lib; }) findModulesList; inherit (import ./find-modules.nix { inherit lib; }) findModulesList;
#supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; #supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
supportedSystems = [ "x86_64-linux" ]; supportedSystems = [ "x86_64-linux" ];
in rec { in
rec {
forAllSystems = f: genAttrs supportedSystems (system: f (import nixpkgs { inherit system; })); forAllSystems = f: genAttrs supportedSystems (system: f (import nixpkgs { inherit system; }));
nixosModules = listToAttrs (findModulesList ../modules); nixosModules = listToAttrs (findModulesList ../modules);
mkSystem = hostname: mkSystem =
hostname:
nixosSystem { nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = modules = [
[
../modules/oizys.nix ../modules/oizys.nix
../overlays ../overlays
] ] ++ filter isNixFile (listFilesRecursive (../. + "/hosts/${hostname}"));
++ filter
isNixFile
(listFilesRecursive (../. + "/hosts/${hostname}"));
specialArgs = {inherit inputs lib self mkDefaultOizysModule mkOizysModule enabled mkRune;}; specialArgs = {
inherit
inputs
lib
self
mkDefaultOizysModule
mkOizysModule
enabled
;
};
}; };
oizysHosts = mapAttrs (name: _: mkSystem name) (readDir ../hosts); oizysHosts = mapAttrs (name: _: mkSystem name) (readDir ../hosts);
oizysPkg = forAllSystems ( oizysPkg = forAllSystems (pkgs: rec {
pkgs: rec {
oizys-zig = pkgs.callPackage ../pkgs/oizys/oizys-zig { zig2nix = inputs.zig2nix; }; oizys-zig = pkgs.callPackage ../pkgs/oizys/oizys-zig { zig2nix = inputs.zig2nix; };
oizys-nim = pkgs.callPackage ../pkgs/oizys/oizys-nim { }; oizys-nim = pkgs.callPackage ../pkgs/oizys/oizys-nim { };
oizys-rs = pkgs.callPackage ../pkgs/oizys/oizys-rs { }; oizys-rs = pkgs.callPackage ../pkgs/oizys/oizys-rs { };
oizys-go = pkgs.callPackage ../pkgs/oizys/oizys-go { }; oizys-go = pkgs.callPackage ../pkgs/oizys/oizys-go { };
default = oizys-go; default = oizys-go;
} });
); devShells = forAllSystems (pkgs: {
devShells = forAllSystems (
pkgs: {
default = pkgs.mkShell { default = pkgs.mkShell {
packages = with pkgs; [git deadnix]; packages = with pkgs; [
git
deadnix
];
}; };
} });
);
oizysFlake = { oizysFlake = {
nixosModules = nixosModules; nixosModules = nixosModules;
nixosConfigurations = oizysHosts; nixosConfigurations = oizysHosts;
packages = oizysPkg; packages = oizysPkg;
devShells = devShells; devShells = devShells;
formatter = forAllSystems (pkgs: pkgs.alejandra); formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
}; };
} }

View file

@ -1,33 +1,42 @@
final: prev: let final: prev:
inherit (final) hasSuffix mkEnableOption mkIf mkOption types; let
runes = import ../modules/runes; inherit (final)
in rec { hasSuffix
enabled = {enable = true;}; mkEnableOption
disabled = {enable = false;}; mkIf
mkOption
types
;
in
rec {
enabled = {
enable = true;
};
disabled = {
enable = false;
};
# ["a" "b"] -> {a.enable = true; b.enable = true;} # ["a" "b"] -> {a.enable = true; b.enable = true;}
enableAttrs = attrs: enableAttrs =
builtins.listToAttrs (map (attr: { attrs:
builtins.listToAttrs (
map (attr: {
name = attr; name = attr;
value = enabled; value = enabled;
}) }) attrs
attrs); );
# ["a" "b"] -> {a.enable = false; b.enable = false;} # ["a" "b"] -> {a.enable = false; b.enable = false;}
disableAttrs = attrs: disableAttrs =
builtins.listToAttrs (map (attr: { attrs:
builtins.listToAttrs (
map (attr: {
name = attr; name = attr;
value = disabled; value = disabled;
}) }) attrs
attrs); );
isNixFile = path: hasSuffix ".nix" path; isNixFile = path: hasSuffix ".nix" path;
mkIfIn = name: list: prev.mkIf (builtins.elem name list); mkIfIn = name: list: prev.mkIf (builtins.elem name list);
mkRune = {
rune,
number ? "6",
runeKind ? "braille",
}:
"[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n";
mkOizysModule = config: attr: content: { mkOizysModule = config: attr: content: {
options.oizys.${attr}.enable = mkEnableOption "enable ${attr} support"; options.oizys.${attr}.enable = mkEnableOption "enable ${attr} support";

View file

@ -1,25 +1,39 @@
{...}: let { ... }:
inherit (builtins) concatLists attrValues mapAttrs elemAt match readDir; let
in rec { inherit (builtins)
concatLists
attrValues
mapAttrs
elemAt
match
readDir
;
in
rec {
# https://github.com/balsoft/nixos-config/blob/73cc2c3a8bb62a9c3980a16ae70b2e97af6e1abd/flake.nix#L109-L120 # https://github.com/balsoft/nixos-config/blob/73cc2c3a8bb62a9c3980a16ae70b2e97af6e1abd/flake.nix#L109-L120
findModulesList = dir: findModulesList =
concatLists (attrValues (mapAttrs dir:
(name: type: concatLists (
if type == "regular" attrValues (
then [ mapAttrs (
name: type:
if type == "regular" then
[
{ {
name = elemAt (match "(.*)\\.nix" name) 0; name = elemAt (match "(.*)\\.nix" name) 0;
value = dir + "/${name}"; value = dir + "/${name}";
} }
] ]
else if else if (readDir (dir + "/${name}")) ? "default.nix" then
(readDir (dir + "/${name}")) [
? "default.nix"
then [
{ {
inherit name; inherit name;
value = dir + "/${name}"; value = dir + "/${name}";
} }
] ]
else findModulesList (dir + "/${name}")) (readDir dir))); else
findModulesList (dir + "/${name}")
) (readDir dir)
)
);
} }

View file

@ -3,9 +3,11 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (lib) mkIf; inherit (lib) mkIf;
in { in
{
config = mkIf config.oizys.desktop.enable { config = mkIf config.oizys.desktop.enable {
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [

View file

@ -4,9 +4,11 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (lib) mkIf; inherit (lib) mkIf;
in { in
{
config = mkIf config.oizys.desktop.enable { config = mkIf config.oizys.desktop.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
wezterm wezterm

View file

@ -3,15 +3,21 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (lib) mkIf; inherit (lib) mkIf;
cfg = config.services.xserver.windowManager.qtile; cfg = config.services.xserver.windowManager.qtile;
lock = pkgs.writeShellApplication { lock = pkgs.writeShellApplication {
name = "lock"; name = "lock";
runtimeInputs = with pkgs; [i3lock-color figlet procps]; runtimeInputs = with pkgs; [
i3lock-color
figlet
procps
];
text = builtins.readFile ./lock.sh; text = builtins.readFile ./lock.sh;
}; };
in { in
{
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
xss-lock xss-lock

View file

@ -15,9 +15,7 @@
# ''; # '';
# }; # };
mkOizysModule config "hyprland" { mkOizysModule config "hyprland" {
programs.hyprland = programs.hyprland = enabled // {
enabled
// {
package = inputs.hyprland.packages.${pkgs.system}.default; package = inputs.hyprland.packages.${pkgs.system}.default;
}; };
security.pam.services.swaylock = { }; security.pam.services.swaylock = { };

View file

@ -3,10 +3,12 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (lib) mkIf; inherit (lib) mkIf;
cfg = config.services.xserver.windowManager.qtile; cfg = config.services.xserver.windowManager.qtile;
in { in
{
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
brightnessctl brightnessctl

View file

@ -1,11 +1,6 @@
{ pkgs, self, ... }:
{ {
pkgs, imports = with self.nixosModules; [ git ];
self,
...
}: {
imports = with self.nixosModules; [
git
];
programs.zsh.enable = true; programs.zsh.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
tmux tmux

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
git git
git-lfs git-lfs

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim vim
neovim neovim

View file

@ -3,9 +3,11 @@
lib, lib,
config, config,
... ...
}: let }:
let
inherit (lib) mkIf; inherit (lib) mkIf;
in { in
{
config = mkIf config.oizys.desktop.enable { config = mkIf config.oizys.desktop.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# vscode # vscode

View file

@ -1,7 +1,21 @@
{lib, ...}: let { lib, ... }:
inherit (lib) mkOption types literalExpression mdDoc; let
in { inherit (lib)
imports = [./nim.nix ./tex.nix ./misc.nix ./node.nix ./python.nix ./zig.nix]; mkOption
types
literalExpression
mdDoc
;
in
{
imports = [
./nim.nix
./tex.nix
./misc.nix
./node.nix
./python.nix
./zig.nix
];
options.oizys.languages = mkOption { options.oizys.languages = mkOption {
type = with types; (listOf str); type = with types; (listOf str);
description = mdDoc '' description = mdDoc ''

View file

@ -3,10 +3,12 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
inherit (lib) mkIfIn; inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
in { in
{
config = mkIfIn "misc" cfg { config = mkIfIn "misc" cfg {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
go go

View file

@ -3,10 +3,12 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
inherit (lib) mkIfIn; inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
in { in
{
config = mkIfIn "nim" cfg { config = mkIfIn "nim" cfg {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
nim nim

View file

@ -3,10 +3,12 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
inherit (lib) mkIfIn; inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
in { in
{
config = mkIfIn "node" cfg { config = mkIfIn "node" cfg {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
nodejs nodejs

View file

@ -3,15 +3,19 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
inherit (lib) mkIfIn; inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
in { in
{
config = mkIfIn "python" cfg { config = mkIfIn "python" cfg {
environment.systemPackages = let environment.systemPackages =
let
python = pkgs.python3.withPackages (ps: with ps; [ pip ]); python = pkgs.python3.withPackages (ps: with ps; [ pip ]);
in in
with pkgs; [ with pkgs;
[
# https://github.com/Mic92/nix-ld?tab=readme-ov-file#my-pythonnodejsrubyinterpreter-libraries-do-not-find-the-libraries-configured-by-nix-ld # https://github.com/Mic92/nix-ld?tab=readme-ov-file#my-pythonnodejsrubyinterpreter-libraries-do-not-find-the-libraries-configured-by-nix-ld
(pkgs.writeShellScriptBin "python" '' (pkgs.writeShellScriptBin "python" ''
export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH

View file

@ -3,13 +3,13 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
inherit (lib) mkIfIn; inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
in { in
{
config = mkIfIn "tex" cfg { config = mkIfIn "tex" cfg {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ texlive.combined.scheme-full ];
texlive.combined.scheme-full
];
}; };
} }

View file

@ -4,13 +4,18 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
inherit (lib) mkIfIn; inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
zig = inputs.zig2nix.outputs.packages.${pkgs.system}.zig.master.bin; zig = inputs.zig2nix.outputs.packages.${pkgs.system}.zig.master.bin;
zls = inputs.zls.outputs.packages.${pkgs.system}.default; zls = inputs.zls.outputs.packages.${pkgs.system}.default;
in { in
{
config = mkIfIn "zig" cfg { config = mkIfIn "zig" cfg {
environment.systemPackages = [zig zls]; environment.systemPackages = [
zig
zls
];
}; };
} }

View file

@ -5,7 +5,10 @@
... ...
}: }:
mkOizysModule config "vpn" { mkOizysModule config "vpn" {
environment.systemPackages = with pkgs; [openconnect openvpn]; environment.systemPackages = with pkgs; [
openconnect
openvpn
];
services.openvpn.servers = { services.openvpn.servers = {
express-ny = { express-ny = {

View file

@ -3,10 +3,12 @@
lib, lib,
config, config,
... ...
}: let }:
let
inherit (lib) mkEnableOption mkIf; inherit (lib) mkEnableOption mkIf;
cfg = config.oizys.nix-ld; cfg = config.oizys.nix-ld;
in { in
{
options.oizys.nix-ld.enable = mkEnableOption "enable nix-ld support"; options.oizys.nix-ld.enable = mkEnableOption "enable nix-ld support";
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs.nix-ld.enable = true; programs.nix-ld.enable = true;

View file

@ -3,10 +3,9 @@
self, self,
pkgs, pkgs,
... ...
}: { }:
imports = [ {
inputs.nix-index-database.nixosModules.nix-index imports = [ inputs.nix-index-database.nixosModules.nix-index ];
];
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nix.package = pkgs.nixVersions.latest; nix.package = pkgs.nixVersions.latest;

View file

@ -1,13 +1,13 @@
{ { lib, self, ... }:
lib, let
self,
...
}: let
inherit (lib) mkEnableOption; inherit (lib) mkEnableOption;
in { in
{
imports = with self.nixosModules; [ imports = with self.nixosModules; [
users users
runes
nix nix
cli cli
dev dev
nvim nvim

View file

@ -22,16 +22,8 @@ mkOizysModule config "chrome" {
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
(chromium.override { (chromium.override { commandLineArgs = [ "--force-dark-mode" ]; })
commandLineArgs = [
"--force-dark-mode"
];
})
(google-chrome.override { (google-chrome.override { commandLineArgs = [ "--force-dark-mode" ]; })
commandLineArgs = [
"--force-dark-mode"
];
})
]; ];
} }

View file

@ -1,5 +1,6 @@
{ {
braille = '' braille = ''

View file

@ -1,5 +1,71 @@
{ {
pkgs,
config,
lib,
...
}:
let
inherit (lib)
types
mkMerge
mkOption
mkIf
mkEnableOption
;
runes = {
othalan = import ./othalan.nix; othalan = import ./othalan.nix;
algiz = import ./algiz.nix; algiz = import ./algiz.nix;
mannaz = import ./mannaz.nix; mannaz = import ./mannaz.nix;
};
mkRune =
{
name,
number ? "6",
kind ? "braille",
}:
"[1;3${number}m\n" + runes.${name}.${kind} + "\n";
cfg = config.oizys.rune;
in
{
options.oizys = {
rune = {
enable = mkOption {
type = types.bool;
default = true;
};
motd.enable = mkEnableOption "set rune for MOTD";
name = mkOption {
default = config.networking.hostName;
type = types.either (types.enum (builtins.attrNames runes)) types.str;
description = "Name of rune (probabaly matches hostname)";
};
kind = mkOption {
type =
with types;
either (enum [
"ascii"
"braille"
]) str;
default = "ascii";
};
};
};
config = mkMerge [
(mkIf cfg.enable {
environment.etc.issue = {
source = pkgs.writeText "issue" (mkRune {
name = cfg.name;
kind = cfg.kind;
});
};
})
(mkIf cfg.motd.enable {
users.motd = mkRune {
number = "2"; # todo: autogenerate based on hostname?
name = cfg.name;
};
})
];
} }

View file

@ -1,5 +1,6 @@
{ {
braille = '' braille = ''

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.gnupg.agent = { programs.gnupg.agent = {
enable = true; enable = true;
enableSSHSupport = true; enableSSHSupport = true;

View file

@ -3,10 +3,12 @@
lib, lib,
pkgs, pkgs,
... ...
}: let }:
let
inherit (lib) mkOption mkIf types; inherit (lib) mkOption mkIf types;
cfg = config.users.defaultUser; cfg = config.users.defaultUser;
in { in
{
options.users.defaultUser = mkOption { options.users.defaultUser = mkOption {
default = true; default = true;
type = types.bool; type = types.bool;

View file

@ -6,7 +6,5 @@
}: }:
mkOizysModule config "docker" { mkOizysModule config "docker" {
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ lazydocker ];
lazydocker
];
} }

View file

@ -1,8 +1,4 @@
{ { config, mkOizysModule, ... }:
config,
mkOizysModule,
...
}:
mkOizysModule config "vbox" { mkOizysModule config "vbox" {
virtualisation.virtualbox = { virtualisation.virtualbox = {
host.enable = true; host.enable = true;

View file

@ -1,4 +1,5 @@
{inputs, ...}: let { inputs, ... }:
let
defaultOverlays = defaultOverlays =
# execute and import all overlay files in the current # execute and import all overlay files in the current
# directory with the given args # directory with the given args
@ -6,20 +7,15 @@
# execute and import the overlay file # execute and import the overlay file
(f: (import (./. + "/${f}") { inherit inputs; })) (f: (import (./. + "/${f}") { inherit inputs; }))
# find all overlay files in the current directory # find all overlay files in the current directory
(builtins.filter (builtins.filter (f: f != "default.nix") (builtins.attrNames (builtins.readDir ./.)));
(f: f != "default.nix") in
(builtins.attrNames (builtins.readDir ./.))); {
in { nixpkgs.overlays = defaultOverlays ++ [
nixpkgs.overlays = (final: _prev: {
defaultOverlays
++ [
(
final: _prev: {
stable = import inputs.stable { stable = import inputs.stable {
system = final.system; system = final.system;
config.allowUnfree = true; config.allowUnfree = true;
}; };
} })
)
]; ];
} }

View file

@ -1,4 +1,5 @@
{...}: (final: prev: { { ... }:
(final: prev: {
nim-atlas = prev.nim-atlas.overrideNimAttrs { nim-atlas = prev.nim-atlas.overrideNimAttrs {
version = "unstable"; version = "unstable";
src = final.fetchFromGitHub { src = final.fetchFromGitHub {

View file

@ -1,4 +1,5 @@
{...}: (final: prev: { { ... }:
(final: prev: {
nimble = prev.nimble.overrideNimAttrs { nimble = prev.nimble.overrideNimAttrs {
version = "0.14.2-5e7901760e89108476a4e21976a0ef783403e8fe"; version = "0.14.2-5e7901760e89108476a4e21976a0ef783403e8fe";
requiredNimVersion = 2; requiredNimVersion = 2;

View file

@ -1,4 +1,5 @@
{...}: (final: prev: { { ... }:
(final: prev: {
nimlsp = prev.nimlsp.overrideNimAttrs { nimlsp = prev.nimlsp.overrideNimAttrs {
requiredNimVersion = 2; requiredNimVersion = 2;
nimFlags = [ nimFlags = [

View file

@ -11,7 +11,7 @@ var dryCmd = &cobra.Command{
Short: "poor man's nix flake check", Short: "poor man's nix flake check",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
oizys.CheckFlake(flake) oizys.CheckFlake(flake)
oizys.NixDryRun(oizys.Output(flake, host)) oizys.NixDryRun(flake, host)
}, },
} }

View file

@ -1,5 +1,4 @@
{ {
installShellFiles, installShellFiles,
buildGoModule, buildGoModule,
lib, lib,
@ -10,7 +9,7 @@ buildGoModule {
version = "unstable"; version = "unstable";
src = lib.cleanSource ./.; src = lib.cleanSource ./.;
vendorHash = "sha256-kh/7dV49KaQcD9ho8IpBcRc6+05bn4XpMzAI9JXu7+o="; vendorHash = "sha256-Fcq8p/YItF5lx82PRg1/tksV7iCIS0xZZVWdpE3e7F0=";
nativeBuildInputs = [ installShellFiles ]; nativeBuildInputs = [ installShellFiles ];

View file

@ -13,6 +13,7 @@ require (
require ( require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/briandowns/spinner v1.23.0 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/fatih/color v1.16.0 // indirect github.com/fatih/color v1.16.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect

View file

@ -1,5 +1,7 @@
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/briandowns/spinner v1.23.0 h1:alDF2guRWqa/FOZZYWjlMIx2L6H0wyewPxo/CH4Pt2A=
github.com/briandowns/spinner v1.23.0/go.mod h1:rPG4gmXeN3wQV/TsAY4w8lPdIM6RX3yqeBQJSrbXjuE=
github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0= github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0=
github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw=
github.com/charmbracelet/bubbletea v0.26.1 h1:xujcQeF73rh4jwu3+zhfQsvV18x+7zIjlw7/CYbzGJ0= github.com/charmbracelet/bubbletea v0.26.1 h1:xujcQeF73rh4jwu3+zhfQsvV18x+7zIjlw7/CYbzGJ0=

View file

@ -12,6 +12,9 @@ import (
"github.com/charmbracelet/bubbles/table" "github.com/charmbracelet/bubbles/table"
"github.com/muesli/termenv" "github.com/muesli/termenv"
"golang.org/x/term" "golang.org/x/term"
"github.com/briandowns/spinner"
"time"
) )
func TerminalSize() (int, int) { func TerminalSize() (int, int) {
@ -63,10 +66,19 @@ func ParseDryRunOutput(nixOutput string) {
ShowTable(columns, rows) ShowTable(columns, rows)
} }
func NixDryRun(path string) { func NixDryRun(flake string, host string) {
path := Output(flake, host)
cmd := exec.Command("nix", "build", path, "--dry-run") cmd := exec.Command("nix", "build", path, "--dry-run")
s := spinner.New(
spinner.CharSets[14],
100*time.Millisecond,
spinner.WithSuffix(" evaluating derivation for: "+path),
spinner.WithColor("fgHiMagenta"))
s.Start()
output, err := cmd.CombinedOutput() output, err := cmd.CombinedOutput()
s.Stop()
if err != nil { if err != nil {
fmt.Println(string(output))
log.Fatal(err) log.Fatal(err)
} }
ParseDryRunOutput(string(output)) ParseDryRunOutput(string(output))

View file

@ -6,8 +6,8 @@
}: }:
(zig2nix.outputs.zig-env.${pkgs.system} { (zig2nix.outputs.zig-env.${pkgs.system} {
zig = zig2nix.outputs.packages.${pkgs.system}.zig.master.bin; zig = zig2nix.outputs.packages.${pkgs.system}.zig.master.bin;
}) }).package
.package { {
name = "oizys"; name = "oizys";
src = lib.cleanSource ./.; src = lib.cleanSource ./.;
} }