add de cosmic to new flake based approach

This commit is contained in:
RingOfStorms (Joshua Bell) 2024-12-27 14:57:44 -06:00
parent b69246de06
commit 985d584213
14 changed files with 426 additions and 68 deletions

8
flake.lock generated
View file

@ -1418,11 +1418,11 @@
"rust-overlay": "rust-overlay_3" "rust-overlay": "rust-overlay_3"
}, },
"locked": { "locked": {
"lastModified": 1735017137, "lastModified": 1735329660,
"narHash": "sha256-JXVFiAO3NpnxED+//+MS0aEElIJlUIsCyiWL5mEooug=", "narHash": "sha256-orVsy4BTlJjFFl8sZdKf0qOH0A7eISKqxu9upISnFw8=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "31b96e313a70650fee70bd33765bb4ffbeabcb1e", "rev": "b43def52fc1f11d6438bc657842b1b876ffebbcd",
"revCount": 247, "revCount": 248,
"type": "git", "type": "git",
"url": "https://git.joshuabell.xyz/nvim" "url": "https://git.joshuabell.xyz/nvim"
}, },

99
hosts/oren/flake.lock generated
View file

@ -25,6 +25,33 @@
"type": "github" "type": "github"
} }
}, },
"cosmic": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"mods_de_cosmic",
"nixpkgs"
],
"nixpkgs-stable": [
"mods_de_cosmic",
"nixpkgs-stable"
],
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1735263434,
"narHash": "sha256-5Bn1c2sWzedpGV+PNfXtoainQ3uUKkx/v7T3N6lKKms=",
"owner": "lilyinstarlight",
"repo": "nixos-cosmic",
"rev": "e5fdfe023742172ec0e7af0ca6d88362228d14b7",
"type": "github"
},
"original": {
"owner": "lilyinstarlight",
"repo": "nixos-cosmic",
"type": "github"
}
},
"crane": { "crane": {
"locked": { "locked": {
"lastModified": 1725409566, "lastModified": 1725409566,
@ -64,6 +91,22 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1717312683,
"narHash": "sha256-FrlieJH50AuvagamEvWMIE6D2OAnERuDboFDYAED/dE=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "38fd3954cf65ce6faf3d0d45cd26059e059f07ea",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems_2" "systems": "systems_2"
@ -129,12 +172,12 @@
"mods_boot_systemd": { "mods_boot_systemd": {
"locked": { "locked": {
"lastModified": 1, "lastModified": 1,
"narHash": "sha256-q8gMFwivaZtlaqp44mV7W5M8T5RkBhvjnikr6Ed4xIQ=", "narHash": "sha256-9Z/Z8Y4Q1q95zUeJWfUQFyeaAVkhb804kd3tiBpHfpI=",
"path": "/nix/store/prvi2x26ymzgydzr49na2qs7ihgjrq2d-source/modules/boot_systemd", "path": "/nix/store/ka4sn5h3pw93s1j7blv48vn30jfxiw19-source/modules/boot_systemd",
"type": "path" "type": "path"
}, },
"original": { "original": {
"path": "/nix/store/prvi2x26ymzgydzr49na2qs7ihgjrq2d-source/modules/boot_systemd", "path": "/nix/store/ka4sn5h3pw93s1j7blv48vn30jfxiw19-source/modules/boot_systemd",
"type": "path" "type": "path"
} }
}, },
@ -147,12 +190,33 @@
}, },
"locked": { "locked": {
"lastModified": 1, "lastModified": 1,
"narHash": "sha256-lWrwhvR+E4BC9vSKptGrAKy0C12HeasTMCtDmqI0rdY=", "narHash": "sha256-Hgc2b0w7x9oi15wHy45ZAZ3w6UEESORoDNZX2tVyYmc=",
"path": "/nix/store/prvi2x26ymzgydzr49na2qs7ihgjrq2d-source/modules/common", "path": "/nix/store/ka4sn5h3pw93s1j7blv48vn30jfxiw19-source/modules/common",
"type": "path" "type": "path"
}, },
"original": { "original": {
"path": "/nix/store/prvi2x26ymzgydzr49na2qs7ihgjrq2d-source/modules/common", "path": "/nix/store/ka4sn5h3pw93s1j7blv48vn30jfxiw19-source/modules/common",
"type": "path"
}
},
"mods_de_cosmic": {
"inputs": {
"cosmic": "cosmic",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1,
"narHash": "sha256-R80oVWKVWJJBUCYgMiyTtP1X25zf7zo4C0Ziwrrt7aA=",
"path": "/nix/store/ka4sn5h3pw93s1j7blv48vn30jfxiw19-source/modules/de_cosmic",
"type": "path"
},
"original": {
"path": "/nix/store/ka4sn5h3pw93s1j7blv48vn30jfxiw19-source/modules/de_cosmic",
"type": "path" "type": "path"
} }
}, },
@ -202,6 +266,7 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"mods_boot_systemd": "mods_boot_systemd", "mods_boot_systemd": "mods_boot_systemd",
"mods_common": "mods_common", "mods_common": "mods_common",
"mods_de_cosmic": "mods_de_cosmic",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
}, },
@ -227,6 +292,28 @@
"type": "github" "type": "github"
} }
}, },
"rust-overlay_2": {
"inputs": {
"nixpkgs": [
"mods_de_cosmic",
"cosmic",
"nixpkgs"
]
},
"locked": {
"lastModified": 1735180071,
"narHash": "sha256-ceUDFBsLf5Cz3GlhQAdaJsEfi5s1MDjDsO9VvPFoKAE=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "550e1f10be4a504747a7894c35e887e61235763b",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,

View file

@ -11,6 +11,9 @@
mods_common.url = "../../modules/common"; mods_common.url = "../../modules/common";
mods_common.inputs.nixpkgs.follows = "nixpkgs"; mods_common.inputs.nixpkgs.follows = "nixpkgs";
mods_boot_systemd.url = "../../modules/boot_systemd"; mods_boot_systemd.url = "../../modules/boot_systemd";
mods_de_cosmic.url = "../../modules/de_cosmic";
mods_de_cosmic.inputs.nixpkgs-stable.follows = "nixpkgs";
mods_de_cosmic.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = outputs =

View file

@ -11,8 +11,8 @@
# My custom modules # My custom modules
mods = { mods = {
boot_systemd.enable = true; boot_systemd.enable = true; # new
shell_common.enable = true; shell_common.enable = true; # new
de_cosmic.enable = true; de_cosmic.enable = true;
neovim.enable = true; neovim.enable = true;
tty_caps_esc.enable = true; tty_caps_esc.enable = true;
@ -20,7 +20,7 @@
fonts.enable = true; fonts.enable = true;
stormd.enable = true; stormd.enable = true;
nebula.enable = true; nebula.enable = true;
ssh.enable = true; ssh.enable = true; # new
# rustdesk.enable = true; # rustdesk.enable = true;
}; };

View file

@ -16,9 +16,6 @@
... ...
}: }:
{ {
options = {
};
config = { config = {
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader = { boot.loader = {

View file

@ -1,4 +1,5 @@
{ {
description = "Common flake for all of my systems. ANy logic that I do on all my ssystems I put here so that I don't need to put it into sepratate nix flakes. This includes some basic nix[helper] settings, ragenix secrets, and ssh (ssh keys are used for ragenix)";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -54,6 +55,7 @@
# NOTE: Ragenix requires services.openssh.enable to be true otherwise it would require manually setting public keys, so ssh is enabled in the common module as well # NOTE: Ragenix requires services.openssh.enable to be true otherwise it would require manually setting public keys, so ssh is enabled in the common module as well
./ssh.nix ./ssh.nix
./ragenix.nix ./ragenix.nix
./shell/common.nix
]; ];
config = { config = {
_module.args = { _module.args = {

View file

@ -0,0 +1,81 @@
{
config,
lib,
pkgs,
...
}:
with lib;
{
config = {
networking = {
hostName = config.mods.common.systemName;
extraHosts = ''
127.0.0.1 local.belljm.com
127.0.0.1 n0.local.belljm.com
127.0.0.1 n1.local.belljm.com
127.0.0.1 n2.local.belljm.com
127.0.0.1 n3.local.belljm.com
127.0.0.1 n4.local.belljm.com
'';
# Use nftables not iptables
nftables.enable = true;
firewall.enable = true;
};
environment.systemPackages = with pkgs; [
# Basics
vim
nano
wget
curl
fastfetch
bat
htop
unzip
git
fzf
ripgrep
lsof
killall
hdparm
speedtest-cli
ffmpeg-full
appimage-run
];
environment.shellAliases = {
n = "nvim";
nn = "nvim --headless '+SessionDelete' +qa > /dev/null 2>&1 && nvim";
bat = "bat --theme Coldark-Dark";
cat = "bat --pager=never -p";
# TODO this may not be needed now that I am using `nh` clean mode (see /hosts/_common/configuration.nix#programs.nh)
nix-boot-clean = "find '/boot/loader/entries' -type f ! -name 'windows.conf' | head -n -4 | xargs -I {} rm {}; nix store gc; nixos-rebuild boot; echo; df";
# general unix
date_compact = "date +'%Y%m%d'";
date_short = "date +'%Y-%m-%d'";
ls = "ls --color -Gah";
ll = "ls --color -Galh";
lss = "du --max-depth=0 -h * 2>/dev/null | sort -hr";
psg = "ps aux | head -n 1 && ps aux | grep -v 'grep' | grep";
cl = "clear";
# git
stash = "git stash";
pop = "git stash pop";
branch = "git checkout -b";
status = "git status";
diff = "git diff";
branches = "git branch -a";
gcam = "git commit -a -m";
gcm = "git commit -m";
stashes = "git stash list";
# ripgrep
rg = "rg --no-ignore";
rgf = "rg --files 2>/dev/null | rg";
};
environment.shellInit = builtins.readFile ./common.sh;
};
}

View file

@ -0,0 +1,171 @@
# Check if ~/.config/environment exists and source all files within it
if [ -d "$HOME/.config/environment" ]; then
for file in "$HOME/.config/environment/"*; do
if [ -r "$file" ]; then
if ! . "$file"; then
echo "Failed to source $file"
fi
fi
done
fi
# Basics
htop_psg () {
htop -p $(psg $1 | awk '{r=r s $2;s=","} END{print r}')
}
htop_pid () {
htop -p $(ps -ef | awk -v proc=$1 '$3 == proc { cnt++;if (cnt == 1) { printf "%s",$2 } else { printf ",%s",$2 } }')
}
psg_kill() {
ps aux | grep -v "grep" | grep "${1}" | awk '{print $2}' | while read -r pid; do
if [ -n "${pid}" ]; then
echo "killing ${pid}"
kill -9 "${pid}" &> /dev/null
fi
done
}
psg_terminate() {
ps aux | grep -v "grep" | grep "${1}" | awk '{print $2}' | while read -r pid; do
if [ -n "${pid}" ]; then
echo "Terminating ${pid}"
kill -15 "${pid}" &> /dev/null
fi
done
}
psg_skill() {
ps aux | grep -v "grep" | grep "${1}" | awk '{print $2}' | while read -r pid; do
if [ -n "${pid}" ]; then
echo "Killing ${pid}"
sudo kill -9 "${pid}" &> /dev/null
fi
done
}
mail_clear() {
: > /var/mail/$USER
}
speedtest_fs () {
dir=$(pwd)
drive=$(df -h ${dir} | awk 'NR==2 {print $1}')
echo Testing read speeds on drive ${drive}
sudo hdparm -Tt ${drive}
test_file=$(date +%u%m%d)
test_file="${dir}/speedtest_fs_${test_file}"
echo
echo Testing write speeds into test file: ${test_file}
dd if=/dev/zero of=${test_file} bs=8k count=10k; rm -f ${test_file}
}
speedtest_internet () {
speedtest-cli
}
# git
getdefault () {
git remote show origin | grep "HEAD branch" | sed 's/.*: //'
}
master () {
git stash
git checkout $(getdefault)
pull
}
mp () {
master
prunel
}
pullmaster () {
git pull origin $(getdefault)
}
push () {
B=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git pull origin $B
git push origin $B --no-verify
}
pull () {
git fetch
B=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git pull origin $B
}
forcepush () {
B=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git push origin $B --force
}
remote_branches () {
git branch -a | grep 'remotes' | grep -v -E '.*(HEAD|${DEFAULT})' | cut -d'/' -f 3-
}
local_branches () {
git branch -a | grep -v 'remotes' | grep -v -E '.*(HEAD|${DEFAULT})' | grep -v '^*' | cut -d' ' -f 3-
}
prunel () {
git fetch
git remote prune origin
for local in $(local_branches); do
in=false
for remote in $(remote_branches); do
if [[ ${local} = ${remote} ]]; then
in=true
fi
done;
if [[ $in = 'false' ]]; then
git branch -D ${local}
else
echo 'Skipping branch '${local}
fi
done;
}
checkout () {
git fetch
git checkout $1
pull
}
from_master () {
git checkout $(getdefault) $@
}
# nix
alias nixpkgs=nixpkg
nixpkg () {
if [ $# -eq 0 ]; then
echo "Error: No arguments provided. Please specify at least one package."
return 1
fi
cmd="nix shell"
for pkg in "$@"; do
cmd="$cmd \"nixpkgs#$pkg\""
done
eval $cmd
}
# Marks some files as in "git" but they won't actually get pushed up to the git repo
# Usefull for `gintent .envrc flake.lock flake.nix` to add nix items required by flakes in a git repo that won't want flakes added
gintent() {
for file in "$@"; do
if [ -f "$file" ]; then
git add --intent-to-add "$file"
git update-index --assume-unchanged "$file"
echo "Intent added for $file"
else
echo "File not found: $file"
fi
done
}
alias gintentnix="gintent .envrc flake.lock flake.nix"

View file

@ -0,0 +1,9 @@
(
state: Enabled,
scroll_config: Some((
method: None,
natural_scroll: Some(true),
scroll_button: None,
scroll_factor: None,
)),
)

View file

@ -11,70 +11,64 @@
outputs = outputs =
{ {
self,
cosmic, cosmic,
nixpkgs,
... ...
}: }:
let
lib = nixpkgs.lib;
cosmicConfigDir = ./config;
cosmicFiles = builtins.attrNames (builtins.readDir cosmicConfigDir);
cosmicConfigFiles = builtins.map (fileName: {
name = "cosmic/${fileName}";
value = {
source = "${cosmicConfigDir}/${fileName}";
};
}) cosmicFiles;
cosmicConfigFilesAttrs = builtins.listToAttrs cosmicConfigFiles;
in
with lib;
{ {
nixosModules = { nixosModules = {
default = { default =
options = { {
# mods.de_cosmic = { config,
# nvidiaExtraDisplayFix = mkOption { lib,
# type = types.bool; pkgs,
# default = false; ...
# description = '' }:
# Enable extra display fix for nvidia cards. with lib;
# ''; {
# }; options.mods.de_cosmic = {
# }; users = mkOption {
}; type = types.listOf types.str;
config = { description = "Users to apply cosmic DE settings to.";
default = [
"root"
] ++ (lib.optionals (config.mods.common.primaryUser != null) [ config.mods.common.primaryUser ]);
};
};
imports = [ imports = [
cosmic.nixosModules.default cosmic.nixosModules.default
]; ];
# Use cosmic binary cache config = {
nix.settings = {
substituters = [ "https://cosmic.cachix.org/" ];
trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ];
};
environment.systemPackages = with pkgs; [ # Use cosmic binary cache
wl-clipboard nix.settings = {
]; substituters = [ "https://cosmic.cachix.org/" ];
trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ];
};
# Enable cosmic environment.systemPackages = with pkgs; [
services.desktopManager.cosmic.enable = true; wl-clipboard
services.displayManager.cosmic-greeter.enable = true; ];
environment.cosmic.excludePackages = with pkgs; [
cosmic-edit
cosmic-term
cosmic-store
];
# Config # Enable cosmic
home-manager.backupFileExtension = "bak"; services.desktopManager.cosmic.enable = true;
home-manager.users.${settings.user.username} = { services.displayManager.cosmic-greeter.enable = true;
xdg.configFile = cosmicConfigFilesAttrs; environment.cosmic.excludePackages = with pkgs; [
cosmic-edit
cosmic-term
cosmic-store
];
# Config
environment.etc = lib.mkIf (config.mods.de_cosmic.users != null) (
lib.genAttrs config.mods.de_cosmic.users (user: {
source = ./config;
target = "/home/${user}/.config/cosmic";
})
);
}; };
}; };
};
}; };
}; };
} }

View file

@ -0,0 +1,9 @@
(
state: Enabled,
scroll_config: Some((
method: None,
natural_scroll: Some(true),
scroll_button: None,
scroll_factor: None,
)),
)

View file

@ -1,7 +1,11 @@
# Check if ~/.config/environment exists and source all files within it # Check if ~/.config/environment exists and source all files within it
if [ -d "$HOME/.config/environment" ]; then if [ -d "$HOME/.config/environment" ]; then
for file in "$HOME/.config/environment/"*; do for file in "$HOME/.config/environment/"*; do
[ -r "$file" ] && . "$file" if [ -r "$file" ]; then
if ! . "$file"; then
echo "Failed to source $file"
fi
fi
done done
fi fi

View file

@ -50,7 +50,7 @@ bind C command-prompt -p "session name:" "new-session -s '%%'"
# Tmux util # Tmux util
bind : command-prompt bind : command-prompt
bind C-D detach bind C-d detach
# ========== # ==========
# My options # My options

View file

@ -12,6 +12,7 @@
system.activationScripts.sshConfig = { system.activationScripts.sshConfig = {
# TODO revisit this, this is stupid and ugly what am I doing here... # TODO revisit this, this is stupid and ugly what am I doing here...
# this is just making it so that the root user can fetch from github. I don't think I need this anymore...
text = '' text = ''
mkdir -p /root/.ssh mkdir -p /root/.ssh
ln -snf ${config.age.secrets.nix2github.path} /root/.ssh/nix2github ln -snf ${config.age.secrets.nix2github.path} /root/.ssh/nix2github