Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelroses committed Jan 8, 2025
1 parent 62f27b0 commit e17e6cf
Show file tree
Hide file tree
Showing 55 changed files with 459 additions and 429 deletions.
17 changes: 8 additions & 9 deletions home/isabel/packages/cli/shell/nushell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ let
inherit (lib.strings) concatMapStrings;

cfg = osConfig.garden.programs.nushell;

completions =
cmds:
concatMapStrings (cmd: ''
source "${pkgs.nu_scripts}/share/nu_scripts/custom-completions/${cmd}/${cmd}-completions.nu"
'') cmds;

theme = "catppuccin-${config.catppuccin.flavor}";
in
{
config = mkIf cfg.enable {
Expand All @@ -36,15 +44,6 @@ in
};

extraConfig =
let
completions =
cmds:
concatMapStrings (cmd: ''
source "${pkgs.nu_scripts}/share/nu_scripts/custom-completions/${cmd}/${cmd}-completions.nu"
'') cmds;

theme = "catppuccin-${config.catppuccin.flavor}";
in
completions [
"nix"
"git"
Expand Down
68 changes: 33 additions & 35 deletions modules/darwin/services/skhd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,48 @@ let
inherit (lib.lists) range;
inherit (lib.strings) concatLines;
inherit (builtins) replaceStrings;

mapKeymaps =
cmd:
concatLines (
map (i: replaceStrings [ "Num" ] [ (toString (if (i == 10) then 0 else i)) ] cmd) (range 1 10)
);
in
{
services.skhd = mkIf (config.garden.environment.desktop == "yabai") {
enable = true;
skhdConfig =
let
mapKeymaps =
cmd:
concatLines (
map (i: replaceStrings [ "Num" ] [ (toString (if (i == 10) then 0 else i)) ] cmd) (range 1 10)
);
in
''
#!/usr/bin/env sh
skhdConfig = ''
#!/usr/bin/env sh
# focus window
cmd + ctrl - h : yabai -m window --focus west
cmd + ctrl - j : yabai -m window --focus south
cmd + ctrl - k : yabai -m window --focus north
cmd + ctrl - l : yabai -m window --focus east
# focus window
cmd + ctrl - h : yabai -m window --focus west
cmd + ctrl - j : yabai -m window --focus south
cmd + ctrl - k : yabai -m window --focus north
cmd + ctrl - l : yabai -m window --focus east
# move window
cmd + shift - h : yabai -m window --warp west
cmd + shift - j : yabai -m window --warp south
cmd + shift - k : yabai -m window --warp north
cmd + shift - l : yabai -m window --warp east
# move window
cmd + shift - h : yabai -m window --warp west
cmd + shift - j : yabai -m window --warp south
cmd + shift - k : yabai -m window --warp north
cmd + shift - l : yabai -m window --warp east
# toggle sticky/floating
cmd + shift - s: yabai -m window --toggle sticky --toggle float --toggle topmost
cmd + shift - d: yabai -m window --toggle float
# toggle sticky/floating
cmd + shift - s: yabai -m window --toggle sticky --toggle float --toggle topmost
cmd + shift - d: yabai -m window --toggle float
# fullacreen
shift + alt - f : yabai -m window --toggle native-fullscreen
# fullacreen
shift + alt - f : yabai -m window --toggle native-fullscreen
# open apps
cmd - return : open -na /Applications/Ghostty.app
cmd - b : open -na "Arc"
cmd - e : open -na "Finder"
# open apps
cmd - return : open -na /Applications/Ghostty.app
cmd - b : open -na "Arc"
cmd - e : open -na "Finder"
# ONLY WORKS WITH SIP DISABLED:
# switch to space
${mapKeymaps "cmd + ctrl - Num : yabai -m space --focus Num"}
# send window to desktop and follow focus
${mapKeymaps "cmd + shift - Num : yabai -m window --space Num; yabai -m space --focus Num"}
'';
# ONLY WORKS WITH SIP DISABLED:
# switch to space
${mapKeymaps "cmd + ctrl - Num : yabai -m space --focus Num"}
# send window to desktop and follow focus
${mapKeymaps "cmd + shift - Num : yabai -m window --space Num; yabai -m space --focus Num"}
'';
};
}
3 changes: 3 additions & 0 deletions modules/iso/fixes.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{ inputs, ... }:
{
# We don't want to alter the iso image itself so we prevent rebuilds
system.switch.enable = false;

# fixes "too many open files"
security.pam.loginLimits = [
{
Expand Down
95 changes: 45 additions & 50 deletions modules/iso/image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,52 @@
let
inherit (lib.modules) mkImageMediaOverride;
inherit (lib.sources) cleanSource;
in
{
# We don't want to alter the iso image itself so we prevent rebuilds
system.switch.enable = false;

isoImage =
let
# Get the hostname from our networking name provided in the mkNixosIso builder
# If none is set then default to "nixos"
hostname = config.networking.hostName or "nixos";

# We get the rev of the git tree here and if we don't have one that
# must mean we have made local changes so we call the git tree "dirty"
rev = self.shortRev or "dirty";

# Give all the isos a consistent name
# $hostname-$release-$rev-$arch
name = "${hostname}-${config.system.nixos.release}-${rev}-${pkgs.stdenv.hostPlatform.uname.processor}";
in
{
# From the name defined before we end up with: name.iso
isoName = mkImageMediaOverride "${name}.iso";

# volumeID is used is used by stage 1 of the boot process, so it must be distintctive
volumeID = mkImageMediaOverride name;
# Get the hostname from our networking name provided in the mkNixosIso builder
# If none is set then default to "nixos"
hostname = config.networking.hostName or "nixos";

# maximum compression, in exchange for build speed
squashfsCompression = "zstd -Xcompression-level 19";
# We get the rev of the git tree here and if we don't have one that
# must mean we have made local changes so we call the git tree "dirty"
rev = self.shortRev or "dirty";

# ISO image should be an EFI-bootable volume
makeEfiBootable = true;

# ISO image should be bootable from USB
makeUsbBootable = true;

# remove "-installer" boot menu label
appendToMenuLabel = "";

contents = [
{
# This should help for debugging if we ever get an unbootable system and have to
# prefrom some repairs on the system itself
source = pkgs.memtest86plus + "/memtest.bin";
target = "/boot/memtest.bin";
}
{
# we also provide our flake such that a user can easily rebuild without needing
# to clone the repo, which needlessly slows the install process
source = cleanSource self;
target = "/flake";
}
];
};
# Give all the isos a consistent name
# $hostname-$release-$rev-$arch
name = "${hostname}-${config.system.nixos.release}-${rev}-${pkgs.stdenv.hostPlatform.uname.processor}";
in
{
isoImage = {
# From the name defined before we end up with: name.iso
isoName = mkImageMediaOverride "${name}.iso";

# volumeID is used is used by stage 1 of the boot process, so it must be distintctive
volumeID = mkImageMediaOverride name;

# maximum compression, in exchange for build speed
squashfsCompression = "zstd -Xcompression-level 19";

# ISO image should be an EFI-bootable volume
makeEfiBootable = true;

# ISO image should be bootable from USB
makeUsbBootable = true;

# remove "-installer" boot menu label
appendToMenuLabel = "";

contents = [
{
# This should help for debugging if we ever get an unbootable system and have to
# prefrom some repairs on the system itself
source = pkgs.memtest86plus + "/memtest.bin";
target = "/boot/memtest.bin";
}
{
# we also provide our flake such that a user can easily rebuild without needing
# to clone the repo, which needlessly slows the install process
source = cleanSource self;
target = "/flake";
}
];
};
}
18 changes: 6 additions & 12 deletions modules/iso/nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,17 @@

# fetch from a cache if we can
substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
"https://nixpkgs-unfree.cachix.org"
"https://numtide.cachix.org"
"https://isabelroses.cachix.org"
"https://ags.cachix.org"
"https://hyprland.cachix.org"
"https://nix-community.cachix.org" # nix-community cache
"https://isabelroses.cachix.org" # precompiled binarys from flake
"https://catppuccin.cachix.org" # a cache for all catppuccin ports
"https://cosmic.cachix.org" # for the cosmic desktop
];

trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-unfree.cachix.org-1:hqvoInulhbV4nJ9yJOEr+4wxhDV4xq2d1DK7S6Nj6rs="
"numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE="
"isabelroses.cachix.org-1:mXdV/CMcPDaiTmkQ7/4+MzChpOe6Cb97njKmBQQmLPM="
"ags.cachix.org-1:naAvMrz0CuYqeyGNyLgE010iUiuf/qx6kYrUv3NwAJ8="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"catppuccin.cachix.org-1:noG/4HkbhJb+lUAdKrph6LaozJvAeEEZj4N732IysmU="
"cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
];
};
};
Expand Down
3 changes: 3 additions & 0 deletions modules/nixos/auto-update.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
# disable auto updating
# (personally I think that auto updates are one of the dumbest things that exists)
enable = false;

# update at 3am every day
dates = "*-*-* 03:00:00";

# randomize the update time by up to an hour
# we do this so all the machines don't update at the same time
randomizedDelaySec = "1h";

# specify the where we want to get the updates from
flake = "github:isabelroses/dotfiles";
};
Expand Down
32 changes: 15 additions & 17 deletions modules/nixos/boot/loader/systemd-boot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,21 @@ in
};

config = mkIf (cfg.loader == "systemd-boot") {
boot.loader = {
systemd-boot =
{
enable = mkDefault true;
configurationLimit = 15; # prevent "too many" configuration from showing up on the boot menu
consoleMode = mkDefault "max"; # the default is "keep"
boot.loader.systemd-boot =
{
enable = mkDefault true;
configurationLimit = 15; # prevent "too many" configuration from showing up on the boot menu
consoleMode = mkDefault "max"; # the default is "keep"

# Fix a security hole. See desc in nixpkgs/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
editor = false;
}
// optionalAttrs cfg.memtest.enable {
extraFiles."efi/memtest86plus/memtest.efi" = "${cfg.boot.memtest.package}/memtest.efi";
extraEntries."memtest86plus.conf" = ''
title MemTest86+
efi /efi/memtest86plus/memtest.efi
'';
};
};
# Fix a security hole. See desc in nixpkgs/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
editor = false;
}
// optionalAttrs cfg.memtest.enable {
extraFiles."efi/memtest86plus/memtest.efi" = "${cfg.boot.memtest.package}/memtest.efi";
extraEntries."memtest86plus.conf" = ''
title MemTest86+
efi /efi/memtest86plus/memtest.efi
'';
};
};
}
52 changes: 28 additions & 24 deletions modules/nixos/fs/support.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ lib, config, ... }:
let
inherit (lib.modules) mkIf;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) listOf str;
inherit (lib.options) mkOption;
inherit (lib.lists) elem map;
Expand All @@ -23,35 +23,39 @@ in
'';
};

config = {
warnings = mkIf (fs == [ ]) [
''
You have not set any filesystems in your configuration. This is not recommended
as it may lead to a unusable system.
Please set {option}`config.garden.system.fs` in your configuration to remedy this.
''
];

services = {
# clean btrfs devices
btrfs.autoScrub = mkIf (elem "btrfs" fs) {
config = mkMerge [
{
# discard blocks that are not in use by the filesystem, good for SSDs health
services.fstrim = {
enable = true;
interval = "weekly";
fileSystems = [ "/" ];
};

# discard blocks that are not in use by the filesystem, good for SSDs health
fstrim = {
# include our allowed file systems in the supported fileSystems lists
boot = {
supportedFilesystems = fs;
initrd.supportedFilesystems = fs;
};
}

# clean btrfs devices
(mkIf (elem "btrfs" fs) {
services.btrfs.autoScrub = {
enable = true;
interval = "weekly";
fileSystems = [ "/" ];
};
};
})

# include our allowed file systems in the supported fileSystems lists
boot = {
supportedFilesystems = fs;
initrd.supportedFilesystems = fs;
};
};
(mkIf (fs == [ ]) {
warnings = [
''
You have not set any filesystems in your configuration. This is not recommended
as it may lead to a unusable system.
Please set {option}`config.garden.system.fs` in your configuration to remedy this.
''
];
})
];
}
Loading

0 comments on commit e17e6cf

Please sign in to comment.