Compare commits

...

2 commits

Author SHA1 Message Date
79c7654486
lost the thread on this one 2024-08-11 08:29:46 -05:00
a03cbee7ac
make use of go embed 2024-08-10 18:48:41 -05:00
11 changed files with 107 additions and 107 deletions

View file

@ -1,17 +1,14 @@
{ enabled, ... }: {
enabled,
enableAttrs,
pipeList,
...
}:
{ {
oizys = { oizys = {
languages = [
"nim"
"node" # for docker langservers
"python"
"nushell"
];
rune.motd = enabled; rune.motd = enabled;
docker = enabled; languages = "nim|node|python|nushell" |> pipeList;
backups = enabled; } // ("docker|backups|nix-ld" |> pipeList |> enableAttrs);
nix-ld = enabled;
};
services.restic.backups.gdrive = { services.restic.backups.gdrive = {
# directories created by gitea and soft-serve aren't world readable # directories created by gitea and soft-serve aren't world readable
@ -27,15 +24,6 @@
]; ];
}; };
security.sudo.wheelNeedsPassword = false; # git user handles the forgjo ssh authentication
users.users.git.isNormalUser = true;
users.users = {
daylin = {
extraGroups = [ "docker" ];
};
git = {
isNormalUser = true;
};
};
} }

View file

@ -1,9 +1,10 @@
{ enabled, ... }: { enabled, ... }:
{ {
security.sudo.wheelNeedsPassword = false;
services.resolved = enabled; services.resolved = enabled;
services.fail2ban = { services.fail2ban = enabled // {
enable = true;
maxretry = 5; maxretry = 5;
bantime = "24h"; bantime = "24h";
}; };
@ -26,8 +27,9 @@
# users.mutableUsers = false; # users.mutableUsers = false;
# Use the GRUB 2 boot loader. # Use the GRUB 2 boot loader.
boot.loader.grub.enable = true; boot.loader.grub = enabled // {
boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only device = "/dev/sda"; # or "nodev" for efi only
};
# don't delete this you foo bar # don't delete this you foo bar
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?

View file

@ -4,14 +4,13 @@
desktop = enabled; desktop = enabled;
nix-ld = enabled; nix-ld = enabled;
rune.motd = enabled; rune.motd = enabled;
docker = enabled;
}; };
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver = { services.xserver = enabled // {
enable = true; displayManager.startx = enabled;
displayManager.startx.enable = true; windowManager.qtile = enabled;
windowManager.qtile.enable = true;
}; };
users.users.daylin.extraGroups = [ "docker" ];
} }

View file

@ -1,39 +1,17 @@
{ enabled, config, ... }: {
lib,
config,
enabled,
enableAttrs,
pipeList,
...
}:
{ {
oizys = { oizys = {
vpn = enabled;
desktop = enabled;
hyprland = enabled;
chrome = enabled;
docker = enabled;
nix-ld = enabled // { nix-ld = enabled // {
overkill = enabled; overkill = enabled;
}; };
vbox = enabled; languages = "misc|nim|node|nushell|python|roc|tex|zig" |> pipeList;
backups = enabled; } // ("vpn|desktop|hyprland|chrome|docker|vbox|backups|hp-scanner|llm" |> pipeList |> enableAttrs);
hp-scanner = enabled;
languages = [
"misc"
"nim"
"node"
"nushell"
"python"
"roc"
"tex"
"zig"
];
llm = enabled;
};
services.restic.backups.gdrive = {
user = "daylin";
repository = "rclone:g:archives/othalan";
passwordFile = "/home/daylin/.config/restic/othalan-pass";
paths = [
"/home/daylin/stuff/"
"/home/daylin/dev/"
];
};
users.users.${config.oizys.user}.extraGroups = [ "audio" ];
} }

View file

@ -3,6 +3,16 @@ 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
{ {
services.restic.backups.gdrive = {
user = "daylin";
repository = "rclone:g:archives/othalan";
passwordFile = "/home/daylin/.config/restic/othalan-pass";
paths = [
"/home/daylin/stuff/"
"/home/daylin/dev/"
];
};
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,4 +1,9 @@
{ pkgs, enabled, ... }: {
config,
pkgs,
enabled,
...
}:
{ {
networking.networkmanager = enabled; networking.networkmanager = enabled;
services.fwupd = enabled; services.fwupd = enabled;
@ -21,7 +26,7 @@
support32Bit = true; support32Bit = true;
}; };
}; };
users.users.${config.oizys.user}.extraGroups = [ "audio" ];
environment.systemPackages = with pkgs; [ pamixer ]; environment.systemPackages = with pkgs; [ pamixer ];
# catppuccin/tty move to "module" # catppuccin/tty move to "module"

View file

@ -1,6 +1,11 @@
inputs: final: prev: inputs: final: prev:
let let
inherit (builtins) listToAttrs substring filter; inherit (builtins)
listToAttrs
substring
filter
replaceStrings
;
inherit (final) inherit (final)
concatStringsSep concatStringsSep
hasSuffix hasSuffix
@ -8,6 +13,7 @@ let
mkIf mkIf
mkOption mkOption
types types
splitString
; ;
inherit (final.filesystem) listFilesRecursive; inherit (final.filesystem) listFilesRecursive;
in in
@ -20,6 +26,9 @@ let
enable = false; enable = false;
}; };
# "opt1|opt2" |> pipeList -> ["opt1" "opt2"]
pipeList = s: s |> replaceStrings [ "\n" ] [ "|" ] |> splitString "|" |> filter (s': s' != "");
# ["a" "b"] -> {a.enable = true; b.enable = true;} # ["a" "b"] -> {a.enable = true; b.enable = true;}
enableAttrs = enableAttrs =
attrs: attrs:
@ -70,11 +79,9 @@ let
isNixFile = p: p |> hasSuffix ".nix"; isNixFile = p: p |> hasSuffix ".nix";
isDefaultNixFile = p: p |> hasSuffix "default.nix"; isDefaultNixFile = p: p |> hasSuffix "default.nix";
# filterNotDefaultNixFile = paths: filter (p: !(isDefaultNixFile p) && (isNixFile p)) paths; # filterNotDefaultNixFile = paths: filter (p: !(isDefaultNixFile p) && (isNixFile p)) paths;
filterNotDefaultNixFile = paths: filterNotDefaultNixFile = paths: paths |> filter (p: !(isDefaultNixFile p) && (isNixFile p));
paths |> filter (p: !(isDefaultNixFile p) && (isNixFile p));
# listNixFilesRecursive = dir: filterNotDefaultNixFile (listFilesRecursive dir); # listNixFilesRecursive = dir: filterNotDefaultNixFile (listFilesRecursive dir);
listNixFilesRecursive = dir: listNixFilesRecursive = dir: dir |> listFilesRecursive |> filterNotDefaultNixFile;
dir |> listFilesRecursive |> filterNotDefaultNixFile;
# defaultLinuxPackage = flake: flake.packages.x86_64-linux.default; # defaultLinuxPackage = flake: flake.packages.x86_64-linux.default;
# defaultPackageGeneric = system: flake: "${flake}.packages.${system}.default"; # defaultPackageGeneric = system: flake: "${flake}.packages.${system}.default";
@ -87,9 +94,6 @@ let
pkg = pkgFromSystem system; pkg = pkgFromSystem system;
}; };
functional = {
filterF = list: f: builtins.filter f list;
};
in in
{ {
inherit inherit
@ -108,6 +112,6 @@ in
pkgFromSystem pkgFromSystem
overlayFrom overlayFrom
flakeFromSystem flakeFromSystem
functional pipeList
; ;
} }

View file

@ -14,6 +14,7 @@ let
enableAttrs enableAttrs
isNixFile isNixFile
flakeFromSystem flakeFromSystem
pipeList
; ;
inherit (lib.filesystem) listFilesRecursive; inherit (lib.filesystem) listFilesRecursive;
@ -58,6 +59,7 @@ let
inherit inherit
mkDefaultOizysModule mkDefaultOizysModule
mkOizysModule mkOizysModule
pipeList
enableAttrs enableAttrs
hostName hostName
flake flake

View file

@ -0,0 +1,21 @@
ld-library-path
builder.pl
profile
system-path
nixos-help
nixos-install
nixos-version
nixos-manual-html
nixos-rebuild
nixos-configuration-reference-manpage
nixos-generate-config
nixos-enter
nixos-container
nixos-build-vms
nixos-wsl-version
nixos-wsl-welcome-message
nixos-wsl-welcome
restic-gdrive
gitea
lock
code

View file

@ -255,6 +255,12 @@ func splitDrv(drv string) (string, string) {
return drvName, hash return drvName, hash
} }
const tableTmpl = `# Building Derivations
| derivation | hash |
|---|---|
%s
`
func writeDervationsToStepSummary(drvs []string) { func writeDervationsToStepSummary(drvs []string) {
tableRows := make([]string, len(drvs)) tableRows := make([]string, len(drvs))
for i, drv := range drvs { for i, drv := range drvs {
@ -264,16 +270,7 @@ func writeDervationsToStepSummary(drvs []string) {
name, hash, name, hash,
) )
} }
o.writeToGithubStepSummary(fmt.Sprintf(tableTmpl, strings.Join(tableRows, "\n")))
o.writeToGithubStepSummary(
fmt.Sprintf(`# Building Derivations
| derivation | hash |
|---|---|
%s
`,
strings.Join(tableRows, "\n"),
),
)
} }
func NixBuild(minimal bool, rest ...string) { func NixBuild(minimal bool, rest ...string) {

View file

@ -1,6 +1,7 @@
package oizys package oizys
import ( import (
_ "embed"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
@ -12,22 +13,21 @@ import (
"github.com/charmbracelet/log" "github.com/charmbracelet/log"
) )
var ignoredMap = stringSliceToMap( //go:embed ignored.txt
[]string{ var ignoredList string
// nix var ignoredMap = stringToMap(ignoredList)
"ld-library-path", "builder.pl", "profile", "system-path",
// nixos func stringToMap(s string) map[string]struct{} {
"nixos-help", return stringSliceToMap(strings.Split(s, "\n"))
"nixos-install", "nixos-version", }
"nixos-manual-html", "nixos-rebuild",
"nixos-configuration-reference-manpage", func stringSliceToMap(slice []string) map[string]struct{} {
"nixos-generate-config", "nixos-enter", hashMap := make(map[string]struct{}, len(slice))
"nixos-container", "nixos-build-vms", for _, s := range slice {
"nixos-wsl-version", "nixos-wsl-welcome-message", "nixos-wsl-welcome", hashMap[s] = struct{}{}
// trivial packages }
"restic-gdrive", "gitea", "lock", "code", return hashMap
}, }
)
type Derivation struct { type Derivation struct {
InputDrvs map[string]interface{} InputDrvs map[string]interface{}
@ -72,13 +72,7 @@ func drvNotIgnored(drv string) bool {
return !ok return !ok
} }
func stringSliceToMap(slice []string) map[string]struct{} {
hashMap := make(map[string]struct{}, len(slice))
for _, s := range slice {
hashMap[s] = struct{}{}
}
return hashMap
}
func drvsToInputs(derivation map[string]Derivation) []string { func drvsToInputs(derivation map[string]Derivation) []string {
var drvs []string var drvs []string