nushell, helium + pwas, niri session management

This commit is contained in:
atagen 2026-03-03 00:26:21 +11:00
parent cb72b47661
commit 3b3bfb6b39
21 changed files with 816 additions and 464 deletions

View file

@ -1,41 +0,0 @@
{
lib,
inputs,
getFlakePkg,
...
}:
{
environment.shellAliases = {
#make run0 use aliases
run0 = "run0 --background='' ";
s = "run0";
};
services.dbus.implementation = "broker";
security = {
sudo.enable = false;
polkit = {
enable = true;
extraConfig = ''
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.policykit.exec") {
return polkit.Result.AUTH_ADMIN_KEEP;
}
});
polkit.addRule(function(action, subject) {
if (action.id.indexOf("org.freedesktop.systemd1.") == 0) {
return polkit.Result.AUTH_ADMIN_KEEP;
}
});
'';
};
};
environment.etc."polkit-1/polkitd.conf".text = ''
[Polkitd]
ExpirationSeconds=60
'';
imports = [ inputs.run0-shim.nixosModules.default ];
environment.systemPackages = [ (getFlakePkg inputs.run0-shim) ];
security.soteria.enable = true;
systemd.user.services.niri-flake-polkit = lib.mkForce { };
}

View file

@ -1,9 +1,11 @@
{
pkgs,
lib,
...
}:
scope "user.programs.helix" {
(scope "apps.editor" <| pkgs.helix)
// scope "user.programs.helix" {
enable = true;
# package = getFlakePkg inputs.helix;
settings = {
theme = "nix-rice";
editor = {

51
common/security.nix Normal file
View file

@ -0,0 +1,51 @@
{
lib,
inputs,
getFlakePkg,
...
}:
{
imports = [
inputs.run0-shim.nixosModules.default
inputs.yoke.nixosModules.default
];
environment.shellAliases = {
#make run0 use aliases
run0 = "run0 --background='' ";
s = "run0";
};
services.dbus.implementation = "broker";
security = {
sudo.enable = false;
polkit = {
enable = true;
extraConfig = ''
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.policykit.exec" ||
action.id.indexOf("org.freedesktop.systemd1.") == 0) {
return polkit.Result.AUTH_ADMIN_KEEP;
}
});
'';
};
};
environment.systemPackages = [ (getFlakePkg inputs.run0-shim) ];
security.soteria.enable = true;
systemd.user.services.polkit-soteria = {
after = [ "dbus.socket" ];
requires = [ "dbus.socket" ];
serviceConfig = {
Environment = [
"DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%U/bus"
];
# RestartSec = 3;
};
unitConfig = {
StartLimitIntervalSec = 30;
StartLimitBurst = 5;
};
};
# niri-flake is death
systemd.user.services.niri-flake-polkit = lib.mkForce { };
services.gnome.gnome-keyring.enable = lib.mkForce false;
}

View file

@ -1,78 +1,298 @@
{
lib,
pkgs,
inputs,
getFlakePkg',
# inputs,
# getFlakePkg',
config,
...
}:
let
inherit (pkgs) fish nushell;
inherit (pkgs) nushell;
# init =
# let
# comma = lib.getExe' (getFlakePkg' inputs.nix-index-database "comma-with-db") "comma";
# in
# ''
# function fish_greeting
# ${./rice/header.sh}
# echo ""
# end
# function fish_title
# set -q argv[1]; or set argv fish
# echo (fish_prompt_pwd_dir_length=100 prompt_pwd): $argv;
# end
# function fish_command_not_found
# ${comma} $argv
# end
# '';
prompt = ''
do --env {
def prompt-header [
--left-char: string
]: nothing -> string {
let code = $env.LAST_EXIT_CODE
let jj_workspace_root = try {
jj workspace root err>| ignore
} catch {
""
}
let hostname = if ($env.SSH_CONNECTION? | is-not-empty) {
let hostname = try {
hostname
} catch {
"remote"
}
$"(ansi light_green_bold)@($hostname)(ansi reset) "
} else {
""
}
# https://github.com/nushell/nushell/issues/16205
#
# Case insensitive filesystems strike again!
let pwd = pwd | path expand
let body = if ($jj_workspace_root | is-not-empty) {
let subpath = $pwd | path relative-to $jj_workspace_root
let subpath = if ($subpath | is-not-empty) {
$"(ansi magenta_bold) (ansi reset)(ansi blue)($subpath)"
}
$"($hostname)(ansi light_yellow_bold)($jj_workspace_root | path basename)($subpath)(ansi reset)"
} else {
let pwd = if ($pwd | str starts-with $env.HOME) {
"~" | path join ($pwd | path relative-to $env.HOME)
} else {
$pwd
}
$"($hostname)(ansi cyan)($pwd)(ansi reset)"
}
let command_duration = ($env.CMD_DURATION_MS | into int) * 1ms
let command_duration = if $command_duration <= 2sec {
""
} else {
$"(ansi light_magenta_bold)($command_duration)(ansi light_yellow_bold)"
}
let exit_code = if $code == 0 {
""
} else {
$"(ansi light_red_bold)($code)(ansi light_yellow_bold)"
}
let middle = if $command_duration == "" and $exit_code == "" {
""
} else {
""
}
$"(ansi light_yellow_bold)($left_char)($exit_code)($middle)($command_duration)(ansi reset) ($body)(char newline)"
}
$env.PROMPT_INDICATOR = $"(ansi light_yellow_bold)(ansi reset) "
$env.PROMPT_INDICATOR_VI_NORMAL = $env.PROMPT_INDICATOR
$env.PROMPT_INDICATOR_VI_INSERT = $env.PROMPT_INDICATOR
$env.PROMPT_MULTILINE_INDICATOR = $env.PROMPT_INDICATOR
$env.PROMPT_COMMAND = {||
prompt-header --left-char ""
}
$env.PROMPT_COMMAND_RIGHT = {||
let jj_status = try {
jj --quiet --color always --ignore-working-copy log --no-graph --revisions @ --template '
separate(
" ",
if(empty, label("empty", "(empty)")),
coalesce(
surround(
"\"",
"\"",
if(
description.first_line().substr(0, 24).starts_with(description.first_line()),
description.first_line().substr(0, 24),
description.first_line().substr(0, 23) ++ ""
)
),
label(if(empty, "empty"), description_placeholder)
),
bookmarks.join(", "),
change_id.shortest(),
commit_id.shortest(),
if(conflict, label("conflict", "(conflict)")),
if(divergent, label("divergent prefix", "(divergent)")),
if(hidden, label("hidden prefix", "(hidden)")),
)
' err>| ignore
} catch {
""
}
$jj_status
}
}
'';
aliases = {
"l" = "ls";
"la" = "ls -a";
"gco" = "git checkout";
"gcb" = "git checkout -b";
"gp" = "git push";
"gpf" = "git push --force";
"gl" = "git pull";
"ga" = "git add";
"gcam" = "git commit -am";
"gcl" = "git clone";
"gcd" = "git clone --depth 1";
"lg" = "lazygit";
":q" = "exit";
"fg" = "job unfreeze";
"jobs" = "job list";
};
nuScriptsPath = "${pkgs.nu_scripts}/share/nu_scripts";
nuConfig = pkgs.writeText "config.nu" ''
use std/config *
${lib.mapAttrsToList (n: v: "alias ${n} = ${v}") aliases |> lib.concatStringsSep "\n"}
$env.NU_LIB_DIRS = ( $env.NU_LIB_DIRS | append "${nuScriptsPath}")
use ${nuScriptsPath}/modules/capture-foreign-env
source ${nuScriptsPath}/modules/formats/from-env.nu
let nixos_env = ('source /etc/set-environment' | capture-foreign-env --shell bash)
if ($nixos_env | describe | str starts-with "record") { $nixos_env | load-env }
source ${(pkgs.runCommand "zoxide.nu" { } ''${pkgs.zoxide}/bin/zoxide init nushell >> "$out"'')}
$env.config.buffer_editor = "${lib.getExe config.apps.editor}"
def fresh [] {
clear
${./rice/header.sh}
echo
}
def gap [] {
git commit -a --amend --no-edit
git push --force
}
# direnv
# Initialize the PWD hook as an empty list if it doesn't exist
$env.config.hooks.env_change.PWD = $env.config.hooks.env_change.PWD? | default []
$env.config.hooks.env_change.PWD ++= [{||
if (which direnv | is-empty) {
# If direnv isn't installed, do nothing
return
}
direnv export json | from json | default {} | load-env
# If direnv changes the PATH, it will become a string and we need to re-convert it to a list
$env.PATH = do (env-conversions).path.from_string $env.PATH
}]
# $cmd doesn't carry its args ?
# $env.config.hooks.command_not_found = { |cmd| , $cmd; echo }
$env.config.table.mode = "none";
$env.config.edit_mode = "vi";
$env.config.completions.algorithm = "fuzzy";
# TODO
$env.config.color_config = {
# separator default
# header green_bold
# empty blue
# bool light_cyan
# int default
# filesize cyan
# duration default
# datetime purple
# range default
# float default
# string default
# nothing default
# binary default
# cell-path default
# row_index green_bold
# record default
# list default
# block default
# hints dark_gray
# search_result bg red
# fg white
# shape_binary purple_bold
# shape_block blue_bold
# shape_bool light_cyan
# shape_closure green_bold
# shape_custom green
# shape_datetime cyan_bold
# shape_directory cyan
# shape_external cyan
# shape_externalarg green_bold
# shape_external_resolved light_yellow_bold
# shape_filepath cyan
# shape_flag blue_bold
# shape_float purple_bold
# shape_garbage fg white
# bg red
# attr b
# shape_glob_interpolation cyan_bold
# shape_globpattern cyan_bold
# shape_int purple_bold
# shape_internalcall cyan_bold
# shape_keyword cyan_bold
# shape_list cyan_bold
# shape_literal blue
# shape_match_pattern green
# shape_matching_brackets attr u
# shape_nothing light_cyan
# shape_operator yellow
# shape_pipe purple_bold
# shape_range yellow_bold
# shape_record cyan_bold
# shape_redirection purple_bold
# shape_signature green_bold
# shape_string green
# shape_string_interpolation cyan_bold
# shape_table blue_bold
# shape_variable purple
# shape_vardecl purple
# shape_raw_string light_purple
}
${prompt}
$env.config.show_banner = false
fresh
'';
in
{
imports = [
inputs.culr.nixosModules.culr
];
programs.culr = {
enable = true;
pattern = "rainbow-split";
};
programs.fish = {
enable = true;
shellAbbrs = {
"gco" = "git checkout";
"gcb" = "git checkout -b";
"gp" = "git push";
"gpf" = "git push --force";
"gap" = "git commit -a --amend --no-edit && git push --force";
"gl" = "git pull";
"ga" = "git add";
"gcam" = "git commit -am";
"gcl" = "git clone";
"gcd" = "git clone --depth 1";
":q" = "exit";
};
shellAliases = {
"l" = "eza -lg --icons=always --colour=always $argv | culr";
"la" = "eza -lg --icons=always --colour=always $argv | culr";
"p" = "ps $argv | culr";
"mnt" = "mount | culr";
"fresh" = "clear; ${./rice/header.sh}; echo";
};
interactiveShellInit =
let
comma = lib.getExe' (getFlakePkg' inputs.nix-index-database "comma-with-db") "comma";
in
''
function fish_greeting
${./rice/header.sh}
echo ""
end
function fish_title
set -q argv[1]; or set argv fish
echo (fish_prompt_pwd_dir_length=100 prompt_pwd): $argv;
end
function fish_command_not_found
${comma} $argv
end
'';
};
user.xdg.config.files."nushell/config.nu".source = nuConfig;
programs.command-not-found.enable = false;
programs.zoxide = {
enable = true;
enableFishIntegration = true;
programs.zoxide.enable = true;
environment.shellAliases = {
};
environment.systemPackages = [
fish
nushell
];
environment.shells = [
fish
nushell
];
users.defaultUserShell = fish;
users.defaultUserShell = nushell;
console.font = "Lat2-Terminus16";
environment.sessionVariables = {
environment.variables = {
EDITOR = "hx";
};

363
flake.lock generated
View file

@ -55,11 +55,11 @@
},
"bunker": {
"locked": {
"lastModified": 1771986311,
"narHash": "sha256-+31rsVS6HWC8lgSsBw5LISZabb40GQGU7otVvSpntvw=",
"lastModified": 1772004723,
"narHash": "sha256-sTAQT6QejSY5PSJuoCRtPBAGo/wgWzglgaFqtHvv9KQ=",
"owner": "amaanq",
"repo": "bunker-patches",
"rev": "c3721ff6c6d3a4704e55cb2dde5b91ab1db6bec7",
"rev": "4f77ba4e6b2579290514dcdcbbb5577b64b027cb",
"type": "github"
},
"original": {
@ -68,9 +68,26 @@
"type": "github"
}
},
"crane": {
"locked": {
"lastModified": 1766194365,
"narHash": "sha256-4AFsUZ0kl6MXSm4BaQgItD0VGlEKR3iq7gIaL7TjBvc=",
"owner": "ipetkov",
"repo": "crane",
"rev": "7d8ec2c71771937ab99790b45e6d9b93d15d9379",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"culr": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems"
},
"locked": {
@ -300,7 +317,7 @@
},
"helium": {
"inputs": {
"nixpkgs": "nixpkgs_3"
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1771320802,
@ -316,25 +333,6 @@
"type": "github"
}
},
"helix": {
"inputs": {
"nixpkgs": "nixpkgs_4",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1771915240,
"narHash": "sha256-lu3yU2yw8nb/1F2AUCF3QqBgiBRicxBgpKNM1xa2huU=",
"owner": "helix-editor",
"repo": "helix",
"rev": "c01d024f293240ae9ed4b3fb826f8292105fe3b2",
"type": "github"
},
"original": {
"owner": "helix-editor",
"repo": "helix",
"type": "github"
}
},
"hjem": {
"inputs": {
"nix-darwin": "nix-darwin_2",
@ -405,7 +403,7 @@
"hudcore": {
"inputs": {
"nix-systems": "nix-systems",
"nixpkgs": "nixpkgs_6"
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1771203193,
@ -440,7 +438,9 @@
"meat": {
"inputs": {
"nix-systems": "nix-systems_2",
"nixpkgs": "nixpkgs_7",
"nixpkgs": [
"nixpkgs"
],
"unf": "unf"
},
"locked": {
@ -460,7 +460,7 @@
"naersk": {
"inputs": {
"fenix": "fenix",
"nixpkgs": "nixpkgs_11"
"nixpkgs": "nixpkgs_8"
},
"locked": {
"lastModified": 1768908532,
@ -478,7 +478,7 @@
},
"ndg": {
"inputs": {
"nixpkgs": "nixpkgs_5"
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1766342086,
@ -499,7 +499,7 @@
"inputs": {
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_2",
"nixpkgs": "nixpkgs_8"
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1748103964,
@ -539,7 +539,7 @@
"inputs": {
"niri-stable": "niri-stable",
"niri-unstable": "niri-unstable",
"nixpkgs": "nixpkgs_10",
"nixpkgs": "nixpkgs_7",
"nixpkgs-stable": "nixpkgs-stable",
"xwayland-satellite-stable": "xwayland-satellite-stable",
"xwayland-satellite-unstable": "xwayland-satellite-unstable"
@ -594,15 +594,17 @@
"inputs": {
"naersk": "naersk",
"niri": "niri_2",
"nixpkgs": "nixpkgs_12",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_4"
},
"locked": {
"lastModified": 1772007793,
"narHash": "sha256-XqOZiW/xf15xPV/kuA+FK1lNVGqwWITjPkH5t67y2eg=",
"lastModified": 1772457471,
"narHash": "sha256-y5KsYbzC3MLKr+2M1792jxs3//uV8x9kG+G0LA7cycg=",
"ref": "refs/heads/main",
"rev": "db66162b3f3b59c833dcbc853c65db2d47881795",
"revCount": 43,
"rev": "785619920b8ae1dd147da795cc7e703c3367c34a",
"revCount": 44,
"type": "git",
"url": "https://git.lobotomise.me/atagen/niri-tag"
},
@ -708,7 +710,7 @@
},
"nix-index-database": {
"inputs": {
"nixpkgs": "nixpkgs_13"
"nixpkgs": "nixpkgs_9"
},
"locked": {
"lastModified": 1771734689,
@ -729,7 +731,7 @@
"flake-parts": "flake-parts_3",
"git-hooks-nix": "git-hooks-nix",
"kitty-themes-src": "kitty-themes-src",
"nixpkgs": "nixpkgs_14",
"nixpkgs": "nixpkgs_10",
"nixpkgs-lib": "nixpkgs-lib_2",
"systems": "systems_5"
},
@ -911,70 +913,6 @@
}
},
"nixpkgs_10": {
"locked": {
"lastModified": 1771848320,
"narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2fc6539b481e1d2569f25f8799236694180c0993",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_11": {
"locked": {
"lastModified": 1752077645,
"narHash": "sha256-HM791ZQtXV93xtCY+ZxG1REzhQenSQO020cu6rHtAPk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "be9e214982e20b8310878ac2baa063a961c1bdf6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_12": {
"locked": {
"lastModified": 1768875095,
"narHash": "sha256-dYP3DjiL7oIiiq3H65tGIXXIT1Waiadmv93JS0sS+8A=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ed142ab1b3a092c4d149245d0c4126a5d7ea00b0",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_13": {
"locked": {
"lastModified": 1771369470,
"narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0182a361324364ae3f436a63005877674cf45efb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_14": {
"locked": {
"lastModified": 1768810879,
"narHash": "sha256-6RrqzfHu3e4vvRaDRY0muyl/BkFzCEPfwXmYY8iRjSw=",
@ -989,23 +927,38 @@
"type": "github"
}
},
"nixpkgs_15": {
"nixpkgs_11": {
"locked": {
"lastModified": 1771008912,
"narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=",
"lastModified": 1772016756,
"narHash": "sha256-noRPhcPF6zI2Wc3khn2Uo01AMmLO7CLFRcgSN1CQXSg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a82ccc39b39b621151d6732718e3e250109076fa",
"rev": "154d55d78649878684bc797cec119e66cceed8b5",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a82ccc39b39b621151d6732718e3e250109076fa",
"type": "github"
}
},
"nixpkgs_16": {
"nixpkgs_12": {
"locked": {
"lastModified": 1766309749,
"narHash": "sha256-3xY8CZ4rSnQ0NqGhMKAy5vgC+2IVK0NoVEzDoOh4DA4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a6531044f6d0bef691ea18d4d4ce44d0daa6e816",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_13": {
"locked": {
"lastModified": 1769018530,
"narHash": "sha256-MJ27Cy2NtBEV5tsK+YraYr2g851f3Fl1LpNHDzDX15c=",
@ -1021,39 +974,7 @@
"type": "github"
}
},
"nixpkgs_17": {
"locked": {
"lastModified": 1761656231,
"narHash": "sha256-EiED5k6gXTWoAIS8yQqi5mAX6ojnzpHwAQTS3ykeYMg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e99366c665bdd53b7b500ccdc5226675cfc51f45",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1733935885,
"narHash": "sha256-xyiHLs6KJ1fxeGmcCxKjJE4yJknVJxbC8Y/ZRYyC8WE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5a48e3c2e435e95103d56590188cfed7b70e108c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1770562336,
"narHash": "sha256-ub1gpAONMFsT/GU2hV6ZWJjur8rJ6kKxdm9IlCT0j84=",
@ -1069,23 +990,7 @@
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1759381078,
"narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"nixpkgs_3": {
"locked": {
"lastModified": 1766070988,
"narHash": "sha256-G/WVghka6c4bAzMhTwT2vjLccg/awmHkdKSd2JrycLc=",
@ -1101,7 +1006,7 @@
"type": "github"
}
},
"nixpkgs_6": {
"nixpkgs_4": {
"locked": {
"lastModified": 1746397377,
"narHash": "sha256-5oLdRa3vWSRbuqPIFFmQBGGUqaYZBxX+GGtN9f/n4lU=",
@ -1117,23 +1022,7 @@
"type": "github"
}
},
"nixpkgs_7": {
"locked": {
"lastModified": 1748217807,
"narHash": "sha256-P3u2PXxMlo49PutQLnk2PhI/imC69hFl1yY4aT5Nax8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3108eaa516ae22c2360928589731a4f1581526ef",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_8": {
"nixpkgs_5": {
"locked": {
"lastModified": 1745930157,
"narHash": "sha256-y3h3NLnzRSiUkYpnfvnS669zWZLoqqI6NprtLQ+5dck=",
@ -1149,7 +1038,7 @@
"type": "github"
}
},
"nixpkgs_9": {
"nixpkgs_6": {
"locked": {
"lastModified": 1748217807,
"narHash": "sha256-P3u2PXxMlo49PutQLnk2PhI/imC69hFl1yY4aT5Nax8=",
@ -1165,6 +1054,54 @@
"type": "github"
}
},
"nixpkgs_7": {
"locked": {
"lastModified": 1771848320,
"narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2fc6539b481e1d2569f25f8799236694180c0993",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_8": {
"locked": {
"lastModified": 1752077645,
"narHash": "sha256-HM791ZQtXV93xtCY+ZxG1REzhQenSQO020cu6rHtAPk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "be9e214982e20b8310878ac2baa063a961c1bdf6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_9": {
"locked": {
"lastModified": 1771369470,
"narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0182a361324364ae3f436a63005877674cf45efb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"qstn": {
"inputs": {
"nixpkgs": [
@ -1193,7 +1130,6 @@
"bunker": "bunker",
"culr": "culr",
"helium": "helium",
"helix": "helix",
"hjem": "hjem",
"hjem-rum": "hjem-rum",
"hudcore": "hudcore",
@ -1206,10 +1142,11 @@
"nix-rice": "nix-rice",
"nix-scope-plugin": "nix-scope-plugin",
"nix-shorturl-plugin": "nix-shorturl-plugin",
"nixpkgs": "nixpkgs_15",
"nixpkgs": "nixpkgs_11",
"nixpkgs-stable": "nixpkgs-stable_2",
"qstn": "qstn",
"run0-shim": "run0-shim",
"stash": "stash",
"stasis": "stasis",
"yoke": "yoke"
}
@ -1221,7 +1158,7 @@
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay_4",
"rust-overlay": "rust-overlay_3",
"treefmt-nix": "treefmt-nix_3"
},
"locked": {
@ -1256,27 +1193,6 @@
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"helix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1759631821,
"narHash": "sha256-V8A1L0FaU/aSXZ1QNJScxC12uP4hANeRBgI4YdhHeRM=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "1d7cbdaad90f8a5255a89a6eddd8af24dc89cafe",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": {
"nixpkgs": [
"hjem",
@ -1298,7 +1214,7 @@
"type": "github"
}
},
"rust-overlay_3": {
"rust-overlay_2": {
"inputs": {
"nixpkgs": [
"hjem-rum",
@ -1321,7 +1237,7 @@
"type": "github"
}
},
"rust-overlay_4": {
"rust-overlay_3": {
"inputs": {
"nixpkgs": [
"run0-shim",
@ -1348,7 +1264,7 @@
"hjem",
"nixpkgs"
],
"rust-overlay": "rust-overlay_2",
"rust-overlay": "rust-overlay",
"systems": "systems_2"
},
"locked": {
@ -1372,7 +1288,7 @@
"hjem",
"nixpkgs"
],
"rust-overlay": "rust-overlay_3",
"rust-overlay": "rust-overlay_2",
"systems": "systems_3"
},
"locked": {
@ -1389,17 +1305,36 @@
"type": "github"
}
},
"stash": {
"inputs": {
"crane": "crane",
"nixpkgs": "nixpkgs_12"
},
"locked": {
"lastModified": 1772183710,
"narHash": "sha256-ojaPFnfWFRUi4Nc69T+ObdZ3Bxf62T3bv49qqV+wgHw=",
"owner": "notashelf",
"repo": "stash",
"rev": "181edcefb1fb38bbd1ca306e91ba493bcf4014d9",
"type": "github"
},
"original": {
"owner": "notashelf",
"repo": "stash",
"type": "github"
}
},
"stasis": {
"inputs": {
"flake-parts": "flake-parts_4",
"nixpkgs": "nixpkgs_16"
"nixpkgs": "nixpkgs_13"
},
"locked": {
"lastModified": 1771992007,
"narHash": "sha256-8EmxW16fext1vjZavb5GfeOCIbytRZ4/qc5VzFZfd3w=",
"lastModified": 1772174212,
"narHash": "sha256-Rq3JnZAYzysIPdcVVM/ctKBARPGxKzzae2owVwqNPt8=",
"owner": "saltnpepper97",
"repo": "stasis",
"rev": "ebaa70f5f4773ea2dbd2535897447e643777a247",
"rev": "6ce1a1391e1157457a588701b8ca21e3d72fd7f1",
"type": "github"
},
"original": {
@ -1579,7 +1514,7 @@
"unf": {
"inputs": {
"ndg": "ndg_2",
"nixpkgs": "nixpkgs_9"
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1748163740,
@ -1630,15 +1565,17 @@
},
"yoke": {
"inputs": {
"nixpkgs": "nixpkgs_17",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_7"
},
"locked": {
"lastModified": 1769664021,
"narHash": "sha256-6B99PvFbUW5ca0ucvpI6eWF2wSAUts/5LPZUQvErEkg=",
"lastModified": 1772106982,
"narHash": "sha256-XyHN0Wl9dxknzsAR8c/Ce3BjtqbNhv11xIRG0KeEvm4=",
"ref": "refs/heads/main",
"rev": "c53377a5046f70493ac268aedb5824add94c4ba1",
"revCount": 11,
"rev": "bf06ab5fe821bfa033c290f49949b8adffbef56e",
"revCount": 12,
"type": "git",
"url": "https://git.lobotomise.me/atagen/yoke"
},

View file

@ -4,18 +4,22 @@
outputs = _: { };
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?rev=a82ccc39b39b621151d6732718e3e250109076fa";
nixpkgs.url = "github:NixOS/nixpkgs";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-25.11";
helix.url = "github:helix-editor/helix";
nix-index-database.url = "github:Mic92/nix-index-database";
nix-rice.url = "github:bertof/nix-rice";
meat.url = "git+https://git.lobotomise.me/atagen/meat";
meat = {
url = "atagen:meat";
inputs.nixpkgs.follows = "nixpkgs";
};
culr.url = "git+https://git.lobotomise.me/atagen/culr";
culr = {
url = "atagen:culr";
inputs.nixpkgs.follows = "nixpkgs";
};
niri.url = "github:sodiboo/niri-flake";
@ -29,15 +33,18 @@
inputs.nixpkgs.follows = "nixpkgs";
};
hudcore.url = "git+https://git.lobotomise.me/atagen/hudcore-plymouth.git";
niri-tag.url = "git+https://git.lobotomise.me/atagen/niri-tag";
hudcore.url = "atagen:hudcore-plymouth";
niri-tag = {
url = "atagen:niri-tag";
inputs.nixpkgs.follows = "nixpkgs";
};
angrr.url = "github:linyinfeng/angrr";
arbys.url = "git+https://git.lobotomise.me/atagen/arbys";
arbys.url = "atagen:arbys";
qstn = {
url = "git+https://git.lobotomise.me/atagen/qstn";
url = "atagen:qstn";
inputs.nixpkgs.follows = "nixpkgs";
};
@ -46,18 +53,40 @@
flake = false;
};
yoke.url = "git+https://git.lobotomise.me/atagen/yoke";
yoke = {
url = "atagen:yoke";
inputs.nixpkgs.follows = "nixpkgs";
};
run0-shim = {
url = "github:lordgrimmauld/run0-sudo-shim";
inputs.nixpkgs.follows = "nixpkgs";
};
bunker.url = "github:amaanq/bunker-patches";
bunker.url = "amaan:bunker-patches";
stasis.url = "github:saltnpepper97/stasis";
niri-s76.url = "git+https://git.lobotomise.me/atagen/niri-s76-bridge";
niri-s76.url = "atagen:niri-s76-bridge";
helium.url = "amaan:helium-flake";
nil = {
url = "github:atagen/nil";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-scope-plugin = {
url = "atagen:nix-scope-plugin";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-shorturl-plugin = {
url = "atagen:nix-shorturl-plugin";
inputs.nixpkgs.follows = "nixpkgs";
};
stash.url = "github:notashelf/stash";
};

View file

@ -1,19 +1,30 @@
{ ... }:
{ pkgs, ... }:
{
user.packages = [
];
# hm.programs.firefox.webapps = {
# "Microsoft-Teams" = {
# url = "https://teams.microsoft.com";
# extraSettings = config.hm.programs.firefox.profiles.default.settings;
# name = "Microsoft Teams";
# icon = ../assets/ms_teams.png;
# };
# "Facebook-Messenger" = {
# url = "https://www.messenger.com";
# extraSettings = config.hm.programs.firefox.profiles.default.settings;
# name = "Facebook Messenger";
# icon = ../assets/fb_msg.png;
# };
# };
programs.pwas =
let
papirusIcon = app: "${pkgs.papirus-icon-theme}/share/icons/Papirus-Dark/16x16/apps/${app}.svg";
in
{
cinny = {
name = "Cinny";
url = "https://chat.lobotomise.me";
icon = papirusIcon "in.cinny.Cinny";
description = "Cinny, a Matrix client";
};
discord = {
name = "Discord";
url = "https://discord.com/app";
icon = papirusIcon "discord";
description = "Discord Web";
};
fb-messenger = {
name = "FB Messenger";
url = "https://m.me";
icon = papirusIcon "facebook-facebook.com.svg";
description = "Facebook Messenger";
};
};
xdg.mime.defaultApplications = {
"x-scheme-handler/matrix" = "Cinny-webapp.desktop";
};
}

View file

@ -57,10 +57,10 @@ spawn-at-startup "systemctl" "--user" "start" "startup-sound.service"
window-rule {
match app-id="Bitwarden"
open-floating true
default-column-width { proportion 0.16667; }
default-column-width { proportion 0.2; }
}
window-rule {
match app-id="feishin"
match app-id="chrome-listen.lobotomise.me__-Default"
open-floating true
default-column-width { proportion 0.16667; }
default-column-width { proportion 0.2; }
}

View file

@ -17,14 +17,58 @@ in
inherit (pkgs) wl-clipboard quickshell;
};
imports = [ inputs.stasis.nixosModules.default ];
services.stasis.enable = true;
imports = [
inputs.stasis.nixosModules.default
inputs.stash.nixosModules.default
];
services.stasis = {
enable = true;
extraPathPackages = [ (config.programs.niri.package) ];
extraConfig = ''
default:
dpms_off:
timeout 300
command "niri msg action power-off-monitors"
end
suspend:
timeout 600
command "systemctl suspend"
end
end
'';
};
services.stash-clipboard = {
enable = true;
excludedApps = [ "Bitwarden" ];
};
quick.services = {
noti = "${getExe pkgs.swaynotificationcenter}";
shell = "${getExe pkgs.quickshell}";
pwManager = "${getExe config.apps.passwordManager}";
music = "${getExe config.apps.streamPlayer}";
# music = "${getExe config.apps.streamPlayer}";
};
user.systemd.services.music = {
environment.PATH = lib.mkForce "/run/current-system/sw/bin:/run/current-system/sw/sbin:/etc/profiles/per-user/${mainUser}/bin:/etc/profiles/per-user/${mainUser}/sbin";
unitConfig = {
Description = "airdrome";
Requires = [
"graphical-session.target"
];
After = [
"graphical-session.target"
"niri.target"
];
PartOf = [ "graphical-session.target" ];
};
serviceConfig = {
ExecStart = "${getExe config.apps.streamPlayer}";
Type = "forking";
};
wantedBy = [ "graphical-session.target" ];
};
environment.files."/home/${mainUser}/.config/quickshell" = {

View file

@ -3,6 +3,7 @@
inputs,
getFlakePkg',
lib,
pkgs,
config,
...
}:
@ -61,7 +62,15 @@ in
settings =
let
session = {
command = "niri-session";
command =
let
niri-session-direct = pkgs.writeShellScript "niri-session-direct" ''
systemctl --user import-environment
dbus-update-activation-environment --all
exec ${lib.getExe niri} --session
'';
in
"${niri-session-direct}";
user = "${mainUser}";
};
in
@ -78,13 +87,18 @@ in
services.niri-tag = {
enable = true;
prepopulate = 10;
strict = true;
scratchpads = {
# TODO FIXME these could use the getExe ?
"feishin" = 99;
"chrome-listen.lobotomise.me__-Default" = 99;
"Bitwarden" = 101;
};
};
services.niri-s76-bridge.enable = true;
# niri runs directly from greetd (session-1.scope), not as a user service
systemd.user.services.niri.wantedBy = lib.mkForce [ ];
systemd.user.services.niri.enable = lib.mkForce false;
}

View file

@ -9,5 +9,5 @@ scope "apps" {
noteTaking = obsidian;
ebookReader = foliate;
pdfReader = zathura;
calculator = mate.mate-calc;
calculator = mate-calc;
}

View file

@ -2,7 +2,7 @@
pkgs,
...
}:
with pkgs.mate;
with pkgs;
scope "apps" {
fm = caja;
archive = engrampa;

View file

@ -15,7 +15,6 @@
};
};
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-gnome
];
};

View file

@ -1,23 +1,25 @@
{
pkgs,
lib,
inputs,
mainUser,
...
}:
let
claude-code =
clodTools = with pkgs; [
bash
procps
ripgrep
socat
bubblewrap
];
mkClod =
{
confDir ? null,
suffix ? null,
}:
let
version = "2.1.52";
runtimeDeps = lib.makeBinPath (
[
pkgs.procps
pkgs.ripgrep
]
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
pkgs.bubblewrap
pkgs.socat
]
);
version = "2.1.62";
runtimeDeps = lib.makeBinPath clodTools;
patchScript = pkgs.writeScript "patch-claude-src" ''
#!${pkgs.python3}/bin/python3
@ -110,7 +112,7 @@ let
open(sys.argv[1], "wb").write(data)
'';
in
pkgs.writeShellScriptBin "claude" ''
pkgs.writeShellScriptBin "claude${lib.optionalString (suffix != null) "-${suffix}"}" ''
set -euo pipefail
export DISABLE_AUTOUPDATER=1
export DISABLE_INSTALLATION_CHECKS=1
@ -119,6 +121,7 @@ let
CACHE="''${XDG_CACHE_HOME:-$HOME/.cache}/claude-code"
BIN="$CACHE/claude-${version}"
${lib.optionalString (confDir != null) "export CLAUDE_CONFIG_DIR=\"$HOME/${confDir}\""}
if [ ! -x "$BIN" ]; then
mkdir -p "$CACHE"
@ -132,12 +135,48 @@ let
exec "$BIN" "$@"
'';
claude-code = mkClod { };
claude-koss = mkClod {
suffix = "koss";
confDir = ".clod-koss";
};
in
(scope "apps.slopcode" <| claude-code)
(scope "apps" {
"slop" = claude-code;
"temp-slop" = claude-koss;
})
// {
# required for loaderslop
# required for loader
programs.nix-ld = {
enable = true;
libraries = [ pkgs.stdenv.cc.cc.lib ];
};
# experiment with our own sandboxing
# security.yoke.wrappers =
# let
# basePaths = [
# "wrx=/home/${mainUser}/.claude.json:/home/${mainUser}/.claude-code:/home/${mainUser}/.cache/claude-code:$PWD/.claude"
# "rx=/"
# ];
# base = {
# package = claude-code;
# executable = "claude";
# retainEnv = true;
# unrestrictTcp = true;
# extraPackages = clodTools;
# };
# in
# {
# clod-cuck = base // {
# pathRules = basePaths + [ "rx=$PWD" ];
# };
# clod = base // {
# pathRules = basePaths ++ [
# "wrx=/home/${mainUser}"
# ];
# addPwd = true;
# unrestrictSockets = true;
# unrestrictSignals = true;
# };
# };
}

View file

@ -1,12 +1,27 @@
{
config,
pkgs,
...
}:
with pkgs;
scope "apps" {
(scope "apps" {
videoPlayer = mpv;
imageViewer = imv;
musicPlayer = resonance;
streamPlayer = feishin;
streamPlayer = config.programs.pwas.airdrome.package;
soulSeek = nicotine-plus;
}
})
// (scope "programs.pwas.airdrome" {
name = "Airdrome";
url = "https://listen.lobotomise.me";
icon = builtins.fetchurl {
name = "airdrome.svg";
url = "https://raw.githubusercontent.com/JPGuillemin/Airdrome/refs/heads/master/public/icon.svg";
sha256 = "sha256:1chmza1cbfg028ilz4dqg583s3121iw4fhc136v9f0zf44h76y7m";
};
description = "Airdrome, a Navidrome client";
categories = [
"Music"
"Network"
];
})

View file

@ -36,6 +36,7 @@ scope "options.quick" {
};
serviceConfig = {
ExecStart = cmd;
Restart = "always";
};
wantedBy = [ "graphical-session.target" ];
}) config.quick.services

View file

@ -14,6 +14,7 @@ scope "user.systemd.services.startup-sound"
"graphical-session.target"
"niri.target"
"sound.target"
"shell.service"
];
PartOf = [ "graphical-session.target" ];
};

View file

@ -5,13 +5,36 @@
...
}:
let
inherit (lib) mkIf;
browser = lib.getExe config.apps.browser;
inherit (lib)
mkOption
mkAliasOptionModule
types
mapAttrsToList
attrNames
filterAttrs
replaceStrings
getExe
toLower
;
inherit (types)
str
strMatching
package
path
nullOr
listOf
attrsOf
submodule
either
;
browser = getExe config.apps.browser;
webAppLauncher = pkgs.writeShellScript "web-app-launcher" ''
browser="${browser}"
browser_exec=""
for path in ~/.local ~/.nix-profile /usr; do
for path in ~/.local ~/.nix-profile /usr /nix/var/nix/profiles/system/etc/profiles/per-user/$USER; do
if [ -f "$path/share/applications/$browser.desktop" ]; then
browser_exec=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' "$path/share/applications/$browser.desktop" 2>/dev/null | head -1)
break
@ -45,88 +68,112 @@ let
'';
# Create web app package
createWebApp =
mkWebApp =
{
name,
url,
icon,
description ? "",
categories ? [
"Network"
"Chat"
"InstantMessaging"
],
description,
categories,
}:
let
pkgName = "${lib.replaceStrings [ " " ] [ "-" ] (lib.toLower name)}-web-app";
cleanName = replaceStrings [ " " "\n" "\t" ] [ "-" "-" "-" ] name |> toLower;
pname = "${cleanName}-webapp";
in
{
name = pkgName;
value = pkgs.stdenv.mkDerivation {
pname = pkgName;
version = "1.0";
dontUnpack = true;
pkgs.stdenv.mkDerivation {
inherit pname;
version = "1.0";
dontUnpack = true;
nativeBuildInputs = [
pkgs.copyDesktopItems
pkgs.makeWrapper
];
nativeBuildInputs = [
pkgs.copyDesktopItems
pkgs.makeWrapper
];
installPhase = ''
runHook preInstall
makeWrapper ${webAppLauncher} $out/bin/${pkgName} \
--add-flags "${url}" \
--add-flags "${pkgName}"
runHook postInstall
'';
installPhase = ''
runHook preInstall
makeWrapper ${webAppLauncher} $out/bin/${pname} \
--add-flags "${url}" \
--add-flags "${pname}"
runHook postInstall
'';
desktopItems = [
(pkgs.makeDesktopItem {
inherit icon categories;
name = pkgName;
exec = "${pkgName} %U";
desktopItems = [
(pkgs.makeDesktopItem (
{
name = pname;
exec = "${pname} %U";
desktopName = name;
comment = description;
startupNotify = true;
startupWMClass = pkgName;
})
];
startupWMClass = pname;
}
// filterAttrs (_: v: v != null) {
inherit icon categories;
comment = description;
}
))
];
meta.mainProgram = pname;
};
innerOpts = {
options = {
name = mkOption {
type = str;
};
url = mkOption {
type = strMatching "[hH][tT][tT][pP][sS]?://[^\n\r[:space:]]+";
};
icon = mkOption {
type = nullOr (either str path);
default = null;
};
description = mkOption {
type = nullOr str;
default = null;
};
categories = mkOption {
type = nullOr (listOf str);
default = null;
};
};
};
apps = builtins.listToAttrs (
map createWebApp [
{
name = "Cinny";
url = "https://chat.lobotomise.me";
icon = "cinny";
description = "Cinny, a Matrix client";
}
{
name = "Discord";
url = "https://discord.com/app";
icon = "discord";
description = "Discord Web";
}
{
name = "FB Messenger";
url = "https://m.me";
icon = "facebook";
description = "Facebook Messenger";
}
]
pwaModule = submodule (
{ config, ... }:
{
imports =
let
names = innerOpts.options |> attrNames;
in
map (optName: mkAliasOptionModule [ optName ] [ "settings" optName ]) names;
options = {
settings = mkOption {
type = submodule innerOpts;
default = { };
};
package = mkOption {
type = package;
readOnly = true;
default = mkWebApp config.settings;
};
};
}
);
in
{
config = {
environment.systemPackages = builtins.attrValues apps;
xdg.mime.defaultApplications = {
"x-scheme-handler/matrix" = "cinny-web-app.desktop";
options = {
programs.pwas = mkOption {
description = "PWA Applications";
type = attrsOf pwaModule;
default = { };
};
};
environment.etc."web-apps-setup".text = ''
mkdir -p /home/*/.local/share/web-apps
'';
config = {
environment.systemPackages = mapAttrsToList (_: v: v.package) config.programs.pwas;
};
}

View file

@ -21,12 +21,12 @@
# openrgb no longer recognises the device?
# systemd.services.no-rgb = {
# wantedBy = ["multi-user.target"];
# wantedBy = [ "multi-user.target" ];
# description = "rgb led turn-off-er";
# serviceConfig = {
# Type = "oneshot";
# ExecStart = ''${pkgs.openrgb}/bin/openrgb -d "HyperX DRAM" -m static -c 000000'';
# After = ["openrgb"];
# ExecStart = ''${lib.getExe pkgs.openrgb} -d "HyperX DRAM" -m static -c 000000'';
# After = [ "openrgb" ];
# };
# };

View file

@ -24,10 +24,11 @@ pkgs.stdenv.mkDerivation {
meson
optipng
ninja
dart-sass
;
inherit (pkgs.nodePackages)
sass
;
# inherit (pkgs.nodePackages)
# sass
# ;
inherit (pkgs.gtk4) dev;
inherit rendersvg;
};

View file

@ -1,18 +0,0 @@
{
rustPlatform,
fetchFromGitHub,
...
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "hush";
version = "0.1.4-git";
src = fetchFromGitHub {
owner = "hush-shell";
repo = "hush";
rev = "560c33a2dc8bf967b4fb0c80e3f18ca8934615ff";
hash = "sha256-kJ1o236xvNTPiLPWPgpQLLfEAXCGT419UgVWmwVHBYA=";
};
doCheck = false;
cargoLock.lockFile = "${finalAttrs.src}/Cargo.lock";
})