Compare commits

..

1 commit

Author SHA1 Message Date
d7de392201
wip: switch to niri [skip-ci]
Some checks failed
/ check (nvimDev) (push) Successful in 6s
/ check (nvimHeadless) (push) Successful in 2s
/ check (nvimNoBundledBins) (push) Successful in 4s
/ check (nvimNoLsp) (push) Successful in 5s
/ check (nvimNoTSGrammars) (push) Successful in 5s
/ check (treefmt) (push) Successful in 2s
/ check-renovaterc (push) Successful in 2s
/ build (audiomenu) (push) Successful in 2s
/ build (docs) (push) Successful in 3s
/ build (jpassmenu) (push) Successful in 1s
/ build (nixosConfigurations.vm.config.system.build.toplevel) (push) Failing after 2s
/ build (nvim) (push) Successful in 8s
/ report-size (push) Has been skipped
Looks cooler c:
2025-03-14 22:51:26 +01:00
56 changed files with 1928 additions and 1876 deletions

View file

@ -3,13 +3,22 @@ on:
jobs:
check:
runs-on: nixos
strategy:
matrix:
check:
- nvimDev
- nvimHeadless
- nvimNoBundledBins
- nvimNoLsp
- nvimNoTSGrammars
- treefmt
steps:
- uses: "https://git.salame.cl/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" # v4
- name: Run checks
run: |
nix --version
nix-fast-build --max-jobs 2 --no-nom --skip-cached --no-link \
--flake ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)"
# shellcheck disable=SC2016
nix build --print-build-logs '.#checks.x86_64-linux.${{ matrix.check }}'
check-renovaterc:
runs-on: nixos
steps:
@ -18,30 +27,27 @@ jobs:
run: |
nix --version
nix shell nixpkgs#renovate --command renovate-config-validator
build-packages:
build:
runs-on: nixos
needs: check
strategy:
matrix:
target:
- audiomenu
- docs
- jpassmenu
- nixosConfigurations.vm.config.system.build.toplevel
- nvim
steps:
- uses: "https://git.salame.cl/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" # v4
- name: Build target
run: |
nix --version
nix-fast-build --max-jobs 2 --no-nom --skip-cached --no-link \
--flake ".#packages.$(nix eval --raw --impure --expr builtins.currentSystem)"
build-vm:
runs-on: nixos
needs: build-packages
steps:
- uses: "https://git.salame.cl/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" # v4
- name: Build VM configuration
run: |
nix --version
nix build --print-build-logs '.#nixosConfigurations.vm.config.system.build.toplevel'
# shellcheck disable=SC2016
nix build --print-build-logs '.#${{ matrix.target }}'
report-size:
runs-on: nixos
needs:
- build-packages
- build-vm
needs: build
steps:
- uses: "https://git.salame.cl/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" # v4
- run: nix --version

View file

@ -16,6 +16,7 @@ jobs:
with:
source-url: "https://install.lix.systems/lix/lix-installer-x86_64-linux"
diagnostic-endpoint: ""
- uses: DeterminateSystems/magic-nix-cache-action@6221693898146dc97e38ad0e013488a16477a4c4 # v9
- name: Run `nix flake check`
run: |
nix flake check --verbose --keep-going
@ -24,6 +25,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: DeterminateSystems/magic-nix-cache-action@6221693898146dc97e38ad0e013488a16477a4c4 # v9
- uses: DeterminateSystems/nix-installer-action@v13
with:
source-url: "https://install.lix.systems/lix/lix-installer-x86_64-linux"

View file

@ -3,7 +3,7 @@ authors = ["Jalil David Salamé Messina"]
language = "en"
multilingual = false
src = "src"
title = "Jalil's NixOS configuration modules"
title = "Jalil's NixOS configuration module"
[preprocessor.toc]
command = "mdbook-toc"

View file

@ -1,9 +1,6 @@
# Summary
[Nix Based Configuration](./configuration-overview.md)
- [Nix Based Configuration](./configuration-overview.md)
- [NixOS Module Options](./nixos-options.md)
- [Neovim Module Options](./nvim-options.md)
- [Home Manager Module Options](./home-options.md)
[Search](./search/index.html)

View file

@ -1,41 +0,0 @@
{
imports = [ ./vm-config.nix ];
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "en_US.UTF-8";
users.users.jdoe = {
password = "example";
isNormalUser = true;
extraGroups = [
"wheel"
"video"
"networkmanager"
];
};
home-manager.users.jdoe = {
home = {
username = "jdoe";
homeDirectory = "/home/jdoe";
stateVersion = "24.11";
};
jhome = {
enable = true;
gui.enable = true;
dev = {
enable = true;
rust.enable = true;
};
};
};
# password is 'test' see module documentation for more options
services.jupyter.password = "'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'";
jconfig = {
enable = true;
dev = {
enable = true;
jupyter.enable = true;
};
gui.enable = true;
};
}

View file

@ -1,36 +0,0 @@
## Default QEMU guest config
{
services = {
qemuGuest.enable = true;
openssh.enable = true;
};
boot = {
loader.systemd-boot.enable = true;
initrd.availableKernelModules = [
"xhci_pci"
"ehci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
"virtio_balloon"
"virtio_blk"
"virtio_pci"
"virtio_ring"
# "virtio_vga"
"virtio_gpu"
];
};
fileSystems."/".device = "/dev/disk/by-label/nixos";
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
nixpkgs.hostPlatform = "x86_64-linux";
}

View file

@ -1,4 +1,7 @@
{ inputs, ... }:
let
overlays = builtins.attrValues inputs.self.overlays;
in
{
imports = [
inputs.treefmt-nix.flakeModule
@ -7,15 +10,16 @@
./docs.nix
./example-vm.nix
./nixos-modules.nix
./home-modules.nix
./nixvim-modules.nix
./nvim.nix
./overlays.nix
../scripts
./scripts.nix
];
perSystem =
{ system, ... }:
{
_module.args.pkgs = import inputs.nixpkgs { inherit system overlays; };
# Setup formatters
treefmt = {
projectRootFile = "flake.nix";

View file

@ -1,50 +1,45 @@
{ lib, ... }:
{ lib, inputs, ... }:
{
perSystem =
{ inputs', pkgs, ... }:
{ pkgs, ... }:
{
packages =
let
filterVisible =
toplevelOption: option:
option // { visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption; };
genOptionsDoc =
toplevelOption: module:
pkgs.nixosOptionsDoc {
inherit (lib.evalModules { modules = [ module ]; }) options;
transformOptions = filterVisible toplevelOption;
home-eval = lib.evalModules {
modules = [ ../home/options.nix ];
specialArgs = {
inherit pkgs;
};
mkScope = name: options: {
inherit name;
optionsJSON = "${options.optionsJSON}/share/doc/nixos/options.json";
urlPrefix = "https://github.com/jalil-salame/configuration.nix/blob/main/";
};
search = inputs'.nuschtosSearch.packages.mkMultiSearch {
title = "Search Jalil's configuration.nix";
baseHref = "/";
scopes = [
(mkScope "NixOS" nixos)
(mkScope "Home-Manager" home)
(mkScope "NixVIM" nvim)
];
};
home = genOptionsDoc "jhome" ../modules/hm/options.nix;
nvim = genOptionsDoc "jhome" ../modules/nixvim/options.nix;
nixos = genOptionsDoc "jconfig" ../modules/nixos/options.nix;
nixos-markdown = nixos.optionsCommonMark;
home-markdown = home.optionsCommonMark;
nvim-markdown = nvim.optionsCommonMark;
nvim-eval = lib.evalModules { modules = [ ../nvim/options.nix ]; };
nixos-eval = lib.evalModules { modules = [ ../system/options.nix ]; };
home-markdown =
(pkgs.nixosOptionsDoc {
inherit (home-eval) options;
transformOptions = filterVisible "jhome";
}).optionsCommonMark;
nvim-markdown =
(pkgs.nixosOptionsDoc {
inherit (nvim-eval) options;
transformOptions = filterVisible "jhome";
}).optionsCommonMark;
nixos-markdown =
(pkgs.nixosOptionsDoc {
inherit (nixos-eval) options;
transformOptions = filterVisible "jconfig";
}).optionsCommonMark;
in
{
inherit search;
docs-home-markdown = home-markdown;
docs-nixos-markdown = nixos-markdown;
docs-nvim-markdown = nvim-markdown;
# Documentation
docs = pkgs.stdenvNoCC.mkDerivation {
name = "nixos-configuration-book";
src = ../docs;
src = inputs.self + "/docs";
patchPhase = ''
cleanup_md() {
@ -57,12 +52,10 @@
cleanup_md ${home-markdown} >> ./src/home-options.md
cleanup_md ${nvim-markdown} >> ./src/nvim-options.md
cleanup_md ${nixos-markdown} >> ./src/nixos-options.md
# link search site
ln -s "${search.override { baseHref = "/configuration.nix/search/"; }}" ./src/search
''; # FIXME: only add the `/configuration.nix/` part for GH CI
'';
nativeBuildInputs = [ pkgs.mdbook-toc ];
buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir \"$out\"";
buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out";
};
};
};

View file

@ -1,18 +1,55 @@
{ inputs, lib, ... }:
let
system = "x86_64-linux";
overlays = builtins.attrValues inputs.self.overlays;
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "steam-unwrapped" ];
pkgs = import inputs.nixpkgs { inherit system overlays config; };
in
{
# Example vm configuration
flake.nixosConfigurations.vm = lib.nixosSystem {
inherit system pkgs;
modules = [
inputs.self.nixosModules.default
../example-vm # import vm configuration
inputs.self.nixosModules.vm # import vm module
{
nixpkgs = {
overlays = builtins.attrValues inputs.self.overlays;
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "steam-unwrapped" ];
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "en_US.UTF-8";
users.users.jdoe = {
password = "example";
isNormalUser = true;
extraGroups = [
"wheel"
"video"
"networkmanager"
];
};
home-manager.users.jdoe = {
home = {
username = "jdoe";
homeDirectory = "/home/jdoe";
};
jhome = {
enable = true;
gui.enable = true;
dev = {
enable = true;
rust.enable = true;
};
};
};
# pin nixpkgs to the one used by the system
nix.registry.nixpkgs.flake = inputs.nixpkgs;
# password is 'test' see module documentation for more options
services.jupyter.password = "'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'";
jconfig = {
enable = true;
dev = {
enable = true;
jupyter.enable = true;
};
gui.enable = true;
};
}
];
};
}

View file

@ -1,31 +0,0 @@
{ self, inputs, ... }:
{
# FIXME(25.05): this version of HM should have the flake module
# imports = [ inputs.home-manager.flakeModules.home-manager ];
flake.homeModules =
let
defaultModules = [
inputs.nixvim.homeManagerModules.nixvim
self.nixvimModules.homeManager
../modules/hm
];
nixos = {
imports = defaultModules;
};
standalone = {
imports = defaultModules ++ [
inputs.stylix.homeManagerModules.stilyx
(
{ config, ... }:
{
stylix.image = config.jhome.sway.background;
}
)
];
};
in
{
inherit standalone nixos;
};
}

View file

@ -1,29 +1,46 @@
{
self,
inputs,
lib,
...
}:
{ inputs, lib, ... }:
{
flake.nixosModules =
let
nvim-config = {
imports = [
inputs.nixvim.homeManagerModules.nixvim
../nvim
];
};
homeManagerModuleSandalone = import ../home {
inherit nvim-config;
inherit (inputs) stylix;
};
homeManagerModuleNixOS = import ../home { inherit nvim-config; };
nixosModule = {
imports = [
inputs.stylix.nixosModules.stylix
(import ../system { inherit (inputs) stylix; })
inputs.niri.nixosModules.niri
inputs.home-manager.nixosModules.home-manager
../modules/nixos
] ++ lib.optional (inputs.lix-module != null) inputs.lix-module.nixosModules.default;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [ self.homeModules.nixos ];
sharedModules = [ homeManagerModuleNixOS ];
};
# Pin nixpkgs
nix.registry.nixpkgs.flake = inputs.nixpkgs;
};
machines = [ "vm" ];
mkMachine = hostname: {
imports = [
nixosModule
(import (../machines + "/${hostname}"))
];
home-manager.sharedModules = [ { jhome.hostName = hostname; } ];
};
machineModules = lib.genAttrs machines mkMachine;
in
{
default = nixosModule;
inherit nixosModule;
};
inherit nixosModule homeManagerModuleNixOS homeManagerModuleSandalone;
}
// machineModules;
}

View file

@ -1,62 +0,0 @@
{ self, inputs, ... }:
{
imports = [ inputs.nixvim.flakeModules.default ];
nixvim = {
packages.enable = true;
checks.enable = false; # FIXME: borked due to nix-community/nixvim#3074
};
flake.nixvimModules =
let
module = ../modules/nixvim;
in
{
standalone = "${module}/standalone.nix";
homeManager = module;
};
perSystem =
{ system, ... }:
let
nvimModule = extraConfig: {
inherit system;
modules = [
self.nixvimModules.standalone
# FIXME: borked due to https://github.com/nix-community/nixvim/issues/3140
# { performance.combinePlugins.enable = true; }
extraConfig
];
};
modules = {
nvim = nvimModule { };
# Smaller derivations
nvim-headless = nvimModule {
jhome.nvim.dev.enable = false;
jhome.nvim.reduceSize = true;
};
nvim-small = nvimModule {
jhome.nvim.dev.bundleLSPs = false;
};
nvim-no-ts = nvimModule {
jhome.nvim.dev.bundleGrammars = false;
};
nvim-no-lsps = nvimModule {
jhome.nvim.dev = {
bundleLSPs = false;
bundleGrammars = false;
};
};
};
in
{
checks = builtins.mapAttrs (
_name: module:
inputs.nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule {
module.imports = module.modules;
}
) modules;
nixvimConfigurations = builtins.mapAttrs (_name: inputs.nixvim.lib.evalNixvim) modules;
};
}

53
flake-modules/nvim.nix Normal file
View file

@ -0,0 +1,53 @@
{ inputs, ... }:
{
perSystem =
{ lib, system, ... }:
let
nixvimLib = inputs.nixvim.lib.${system};
nixvim = inputs.nixvim.legacyPackages.${system};
testNvimModule = nixvimLib.check.mkTestDerivationFromNixvimModule;
nvimModule = extraConfig: {
pkgs = inputs.unstable.legacyPackages.${system};
module = {
imports = [ ../nvim/standalone.nix ];
config = lib.mkMerge [
{ performance.combinePlugins.enable = true; }
extraConfig
];
};
};
moduleDev = nvimModule { };
moduleHeadless = nvimModule {
jhome.nvim.dev.enable = false;
jhome.nvim.reduceSize = true;
};
moduleNoLsp = nvimModule { jhome.nvim.dev.bundleLSPs = false; };
moduleNoTSGrammars = nvimModule { jhome.nvim.dev.bundleGrammars = false; };
moduleNoBundledBins = nvimModule {
jhome.nvim.dev = {
bundleLSPs = false;
bundleGrammars = false;
};
};
in
{
# Check standalone nvim build
checks = {
nvimDev = testNvimModule moduleDev;
nvimHeadless = testNvimModule moduleHeadless;
nvimNoLsp = testNvimModule moduleNoLsp;
nvimNoTSGrammars = testNvimModule moduleNoTSGrammars;
nvimNoBundledBins = testNvimModule moduleNoBundledBins;
};
# Nvim standalone module
packages = {
nvim = nixvim.makeNixvimWithModule moduleDev;
# Smaller derivations
nvim-headless = nixvim.makeNixvimWithModule moduleHeadless;
nvim-small = nixvim.makeNixvimWithModule moduleNoBundledBins;
nvim-no-ts = nixvim.makeNixvimWithModule moduleNoTSGrammars;
nvim-no-lsps = nixvim.makeNixvimWithModule moduleNoLsp;
};
};
}

14
flake-modules/scripts.nix Normal file
View file

@ -0,0 +1,14 @@
let
scripts = import ../scripts;
in
{
# Add scripts to overlay
flake.overlays.scripts = final: prev: scripts final;
# Add scripts to packages
perSystem =
{ pkgs, ... }:
{
packages = scripts pkgs;
};
}

192
flake.lock generated
View file

@ -70,11 +70,11 @@
"firefox-gnome-theme": {
"flake": false,
"locked": {
"lastModified": 1743774811,
"narHash": "sha256-oiHLDHXq7ymsMVYSg92dD1OLnKLQoU/Gf2F1GoONLCE=",
"lastModified": 1739223196,
"narHash": "sha256-vAxN2f3rvl5q62gQQjZGVSvF93nAsOxntuFz+e/655w=",
"owner": "rafaelmardojai",
"repo": "firefox-gnome-theme",
"rev": "df53a7a31872faf5ca53dd0730038a62ec63ca9e",
"rev": "a89108e6272426f4eddd93ba17d0ea101c34fb21",
"type": "github"
},
"original": {
@ -90,11 +90,11 @@
]
},
"locked": {
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"lastModified": 1741352980,
"narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9",
"type": "github"
},
"original": {
@ -167,11 +167,11 @@
]
},
"locked": {
"lastModified": 1742649964,
"narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=",
"lastModified": 1737465171,
"narHash": "sha256-R10v2hoJRLq8jcL4syVFag7nIGE7m13qO48wRIukWNg=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
"rev": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17",
"type": "github"
},
"original": {
@ -226,11 +226,11 @@
]
},
"locked": {
"lastModified": 1744743431,
"narHash": "sha256-iyn/WBYDc7OtjSawbegINDe/gIkok888kQxk3aVnkgg=",
"lastModified": 1739757849,
"narHash": "sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c61bfe3ae692f42ce688b5865fac9e0de58e1387",
"rev": "9d3d080aec2a35e05a15cedd281c2384767c2cfe",
"type": "github"
},
"original": {
@ -240,44 +240,18 @@
"type": "github"
}
},
"ixx": {
"inputs": {
"flake-utils": [
"nuschtosSearch",
"flake-utils"
],
"nixpkgs": [
"nuschtosSearch",
"nixpkgs"
]
},
"locked": {
"lastModified": 1737371634,
"narHash": "sha256-fTVAWzT1UMm1lT+YxHuVPtH+DATrhYfea3B0MxG/cGw=",
"owner": "NuschtOS",
"repo": "ixx",
"rev": "a1176e2a10ce745ff8f63e4af124ece8fe0b1648",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"ref": "v0.0.7",
"repo": "ixx",
"type": "github"
}
},
"lix": {
"flake": false,
"locked": {
"lastModified": 1737234286,
"narHash": "sha256-pgDJZjj4jpzkFxsqBTI/9Yb0n3gW+DvDtuv9SwQZZcs=",
"rev": "079528098f5998ba13c88821a2eca1005c1695de",
"narHash": "sha256-CCKIAE84dzkrnlxJCKFyffAxP3yfsOAbdvydUGqq24g=",
"rev": "2837da71ec1588c1187d2e554719b15904a46c8b",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/079528098f5998ba13c88821a2eca1005c1695de.tar.gz?rev=079528098f5998ba13c88821a2eca1005c1695de"
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/2837da71ec1588c1187d2e554719b15904a46c8b.tar.gz?rev=2837da71ec1588c1187d2e554719b15904a46c8b"
},
"original": {
"type": "tarball",
"url": "https://git.lix.systems/lix-project/lix/archive/release-2.92.tar.gz"
"url": "https://git.lix.systems/lix-project/lix/archive/2.92.0.tar.gz"
}
},
"lix-module": {
@ -290,24 +264,68 @@
]
},
"locked": {
"lastModified": 1742943028,
"narHash": "sha256-fprwZKE1uMzO9tiWWOrmLWBW3GPkMayQfb0xOvVFIno=",
"rev": "3fae818597ca2f1474de62022f850c23be50528d",
"lastModified": 1737237494,
"narHash": "sha256-YMLrcBpf0TR5r/eaqm8lxzFPap2TxCor0ZGcK3a7+b8=",
"rev": "b90bf629bbd835e61f1317b99e12f8c831017006",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/3fae818597ca2f1474de62022f850c23be50528d.tar.gz?rev=3fae818597ca2f1474de62022f850c23be50528d"
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/b90bf629bbd835e61f1317b99e12f8c831017006.tar.gz?rev=b90bf629bbd835e61f1317b99e12f8c831017006"
},
"original": {
"type": "tarball",
"url": "https://git.lix.systems/lix-project/nixos-module/archive/release-2.92.tar.gz"
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.92.0.tar.gz"
}
},
"niri": {
"inputs": {
"niri-stable": "niri-stable",
"niri-unstable": [],
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": [
"nixpkgs"
],
"xwayland-satellite-stable": "xwayland-satellite-stable",
"xwayland-satellite-unstable": []
},
"locked": {
"lastModified": 1741686876,
"narHash": "sha256-Kt37Zm9YcQoe/aRVbPFydZcfwIrEAg/U+iz3FcxsOZs=",
"owner": "sodiboo",
"repo": "niri-flake",
"rev": "fa230971ab63885ba5666588a7b78f75f73d5a85",
"type": "github"
},
"original": {
"owner": "sodiboo",
"repo": "niri-flake",
"type": "github"
}
},
"niri-stable": {
"flake": false,
"locked": {
"lastModified": 1740117926,
"narHash": "sha256-mTTHA0RAaQcdYe+9A3Jx77cmmyLFHmRoZdd8RpWa+m8=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "b94a5db8790339cf9134873d8b490be69e02ac71",
"type": "github"
},
"original": {
"owner": "YaLTeR",
"ref": "v25.02",
"repo": "niri",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1745279238,
"narHash": "sha256-AQ7M9wTa/Pa/kK5pcGTgX/DGqMHyzsyINfN7ktsI7Fo=",
"lastModified": 1741445498,
"narHash": "sha256-F5Em0iv/CxkN5mZ9hRn3vPknpoWdcdCyR0e4WklHwiE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9684b53175fc6c09581e94cc85f05ab77464c7e3",
"rev": "52e3095f6d812b91b22fb7ad0bfc1ab416453634",
"type": "github"
},
"original": {
@ -319,11 +337,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1744868846,
"narHash": "sha256-5RJTdUHDmj12Qsv7XOhuospjAjATNiTMElplWnJE9Hs=",
"lastModified": 1738797219,
"narHash": "sha256-KRwX9Z1XavpgeSDVM/THdFd6uH8rNm/6R+7kIbGa+2s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ebe4301cbd8f81c4f8d3244b3632338bbeb6d49c",
"rev": "1da52dd49a127ad74486b135898da2cef8c62665",
"type": "github"
},
"original": {
@ -342,11 +360,11 @@
"nuschtosSearch": []
},
"locked": {
"lastModified": 1745415369,
"narHash": "sha256-XcbDjFXADOGDRXq9da4gvlKBLuMdDQ32ZSem5kf9MmE=",
"lastModified": 1741098523,
"narHash": "sha256-gXDSXDr6tAb+JgxGMvcEjKC9YO8tVOd8hMMZHJLyQ6Q=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "78f6ff036918dcb6369f8b48abcef6a8788096e8",
"rev": "03065fd4708bfdf47dd541d655392a60daa25ded",
"type": "github"
},
"original": {
@ -355,39 +373,14 @@
"type": "github"
}
},
"nuschtosSearch": {
"inputs": {
"flake-utils": [
"lix-module",
"flake-utils"
],
"ixx": "ixx",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1745046075,
"narHash": "sha256-8v4y6k16Ra/fiecb4DxhsoOGtzLKgKlS+9/XJ9z0T2I=",
"owner": "NuschtOS",
"repo": "search",
"rev": "066afe8643274470f4a294442aadd988356a478f",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"repo": "search",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"lix-module": "lix-module",
"niri": "niri",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim",
"nuschtosSearch": "nuschtosSearch",
"stylix": "stylix",
"systems": "systems",
"treefmt-nix": "treefmt-nix",
@ -425,11 +418,11 @@
"tinted-tmux": "tinted-tmux"
},
"locked": {
"lastModified": 1744152965,
"narHash": "sha256-LWUeN1+bH3k46fwtIv0bNgtmkqB0UduyX7T2i+230n0=",
"lastModified": 1740520580,
"narHash": "sha256-QRlcA8rtfNdyKpBE+ptjiB9717Tzum4/sKBSbsyqL6k=",
"owner": "danth",
"repo": "stylix",
"rev": "8748db082ca15d32243c86e5d785d5dfc8a65719",
"rev": "aaa2eb8956770c096f9c46fb163bb26602e20e56",
"type": "github"
},
"original": {
@ -491,11 +484,11 @@
"tinted-tmux": {
"flake": false,
"locked": {
"lastModified": 1743296873,
"narHash": "sha256-8IQulrb1OBSxMwdKijO9fB70ON//V32dpK9Uioy7FzY=",
"lastModified": 1740272597,
"narHash": "sha256-/etfUV3HzAaLW3RSJVwUaW8ULbMn3v6wbTlXSKbcoWQ=",
"owner": "tinted-theming",
"repo": "tinted-tmux",
"rev": "af5152c8d7546dfb4ff6df94080bf5ff54f64e3a",
"rev": "b6c7f46c8718cc484f2db8b485b06e2a98304cd0",
"type": "github"
},
"original": {
@ -511,11 +504,11 @@
]
},
"locked": {
"lastModified": 1744961264,
"narHash": "sha256-aRmUh0AMwcbdjJHnytg1e5h5ECcaWtIFQa6d9gI85AI=",
"lastModified": 1739829690,
"narHash": "sha256-mL1szCeIsjh6Khn3nH2cYtwO5YXG6gBiTw1A30iGeDU=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "8d404a69efe76146368885110f29a2ca3700bee6",
"rev": "3d0579f5cc93436052d94b73925b48973a104204",
"type": "github"
},
"original": {
@ -523,6 +516,23 @@
"repo": "treefmt-nix",
"type": "github"
}
},
"xwayland-satellite-stable": {
"flake": false,
"locked": {
"lastModified": 1739246919,
"narHash": "sha256-/hBM43/Gd0/tW+egrhlWgOIISeJxEs2uAOIYVpfDKeU=",
"owner": "Supreeeme",
"repo": "xwayland-satellite",
"rev": "44590a416d4a3e8220e19e29e0b6efe64a80315d",
"type": "github"
},
"original": {
"owner": "Supreeeme",
"ref": "v0.5.1",
"repo": "xwayland-satellite",
"type": "github"
}
}
},
"root": "root",

View file

@ -12,7 +12,7 @@
unstable.follows = "nixvim/nixpkgs";
# Lix
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/release-2.92.tar.gz";
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.92.0.tar.gz";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.inputs.systems.follows = "systems";
@ -23,6 +23,15 @@
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
niri = {
url = "github:sodiboo/niri-flake";
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
niri-unstable.follows = "";
xwayland-satellite-unstable.follows = "";
};
};
stylix = {
url = "github:danth/stylix/release-24.11";
inputs = {
@ -47,19 +56,10 @@
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
# For the formatter (can be set to null)
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# For generating the docs (can be set to null)
nuschtosSearch = {
url = "github:NuschtOS/search";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "lix-module/flake-utils";
};
};
# For deduplication
systems.url = "github:nix-systems/default";
};

231
home/default.nix Normal file
View file

@ -0,0 +1,231 @@
{
nvim-config,
stylix ? null,
}:
{
config,
pkgs,
lib,
osConfig ? null,
...
}:
let
cfg = config.jhome;
devcfg = cfg.dev;
# Query the osConfig for a setting. Return the default value if missing or in standalone mode
fromOs =
path: default: if osConfig == null then default else lib.attrsets.attrByPath path default osConfig;
in
{
imports =
[
nvim-config
./options.nix
./gui
./users.nix
]
++ lib.optionals (stylix != null) [
stylix.homeManagerModules.stylix
{ stylix.image = cfg.sway.background; }
];
config = lib.mkMerge [
(lib.mkIf (cfg.enable && cfg.styling.enable) {
stylix = {
enable = true;
targets.nixvim.enable = false; # I prefer doing it myself
};
})
(lib.mkIf cfg.enable {
# Add gopass if pass is enabled
home.packages = lib.optional config.programs.password-store.enable pkgs.gopass;
nix.settings.use-xdg-base-directories = fromOs [
"nix"
"settings"
"use-xdg-base-directories"
] true;
programs = {
# Better cat (bat)
bat = {
enable = true;
config = {
# Disable headers and numbers
style = "plain";
theme = lib.mkForce "gruvbox-dark";
};
};
# Direnv
direnv = {
enable = true;
nix-direnv.enable = true;
};
# ls replacement
eza = {
enable = true;
git = true;
icons = "auto";
};
# GnuPG
gpg = {
enable = true;
homedir = "${config.xdg.dataHome}/gnupg";
};
# Mail client
himalaya.enable = lib.mkDefault true;
# Password manager
password-store = {
enable = lib.mkDefault true;
package = pkgs.pass-nodmenu;
settings.PASSWORD_STORE_DIR = "${config.xdg.dataHome}/pass";
};
# SSH
ssh.enable = true;
# cd replacement
zoxide.enable = true;
# Shell
zsh = {
enable = true;
autosuggestion.enable = true;
enableCompletion = true;
autocd = true;
dotDir = ".config/zsh";
history.path = "${config.xdg.dataHome}/zsh/zsh_history";
syntaxHighlighting.enable = true;
};
};
services = {
# GPG Agent
gpg-agent = {
enable = true;
maxCacheTtl = 86400;
pinentryPackage = if config.jhome.gui.enable then pkgs.pinentry-qt else pkgs.pinentry-curses;
extraConfig = "allow-preset-passphrase";
};
# Spotifyd
spotifyd = {
inherit (config.jhome.gui) enable;
settings.global = {
device_name = config.jhome.hostName;
device_type = "computer";
backend = "pulseaudio";
zeroconf_port = 2020;
};
};
};
home = {
stateVersion = "22.11";
# Extra packages
# Extra variables
sessionVariables = {
CARGO_HOME = "${config.xdg.dataHome}/cargo";
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
GOPATH = "${config.xdg.dataHome}/go";
};
shellAliases = {
# Verbose Commands
cp = "cp --verbose";
ln = "ln --verbose";
mv = "mv --verbose";
mkdir = "mkdir --verbose";
rename = "rename --verbose";
rm = "rm --verbose";
# Add Color
grep = "grep --color=auto";
ip = "ip --color=auto";
# Use exa/eza
tree = "eza --tree";
};
};
# XDG directories
xdg = {
enable = true;
userDirs = {
enable = true;
createDirectories = true;
};
};
})
(lib.mkIf (cfg.enable && devcfg.enable) {
home = {
sessionVariables.MANPAGER = lib.optionalString devcfg.neovimAsManPager "nvim -c 'Man!' -o -";
packages = devcfg.extraPackages;
};
# Github CLI
programs = {
gh.enable = true;
gh-dash.enable = true;
# Git
git = {
enable = true;
difftastic = {
enable = true;
background = "dark";
};
lfs.enable = true;
extraConfig = {
# Add diff to the commit message editor
commit.verbose = true;
# Improve submodule diff
diff.submodule = "log";
# Set the default branch name for new branches
init.defaultBranch = "main";
# Better conflicts (also shows parent commit state)
merge.conflictStyle = "zdiff3";
# Do not create merge commits when pulling (rebase but abort on conflict)
pull.ff = "only";
# Use `--set-upstream` if the remote does not have the branch
push.autoSetupRemote = true;
rebase = {
# If there are uncommitted changes, stash them before rebasing
autoStash = true;
# If there are fixup! commits, squash them while rebasing
autoSquash = true;
};
# Enable ReReRe (Reuse Recovered Resolution) auto resolve previously resolved conflicts
rerere.enabled = true;
# Improve submodule status
status.submoduleSummary = true;
};
};
lazygit.enable = true;
# Jujutsu (alternative DVCS (git-compatible))
jujutsu = {
enable = true;
package = pkgs.unstable.jujutsu;
settings = {
ui.pager = "bat";
# mimic git commit --verbose by adding a diff
templates.draft_commit_description = ''
concat(
description,
surround(
"\nJJ: This commit contains the following changes:\n", "",
indent("JJ: ", diff.stat(72)),
),
surround(
"\nJJ: Diff:\n", "",
indent("JJ: ", diff.git()),
),
)
'';
};
};
};
})
(lib.mkIf (cfg.enable && devcfg.enable && devcfg.rust.enable) {
home.packages = [ pkgs.rustup ] ++ devcfg.rust.extraPackages;
# Background code checker (for Rust)
programs.bacon = {
enable = true;
settings = {
export = {
enabled = true;
path = ".bacon-locations";
line_format = "{kind} {path}:{line}:{column} {message}";
};
};
};
})
];
}

View file

@ -21,11 +21,6 @@ let
};
in
{
imports = [
./sway.nix
./waybar.nix
];
config = lib.mkIf (jhome.enable && cfg.enable) {
home.packages =
(with pkgs; [
@ -78,6 +73,24 @@ in
};
# Text editor
nixvim.clipboard.providers.wl-copy.enable = lib.mkDefault true;
# Status bar
waybar = {
enable = true;
systemd.enable = true;
settings = lib.mkIf config.jhome.styling.enable (
import ./waybar-settings.nix { inherit config lib; }
);
style =
lib.optionalString config.jhome.styling.enable # css
''
.modules-left #workspaces button {
border-bottom: 3px solid @base01;
}
.modules-left #workspaces button.persistent {
border-bottom: 3px solid transparent;
}
'';
};
# Terminal
wezterm = {
enable = cfg.terminal == "wezterm";
@ -106,27 +119,17 @@ in
};
};
};
zellij = {
enable = cfg.terminal == "alacritty"; # alacritty has no terminal multiplexer built-in
# Set default shell
settings.default_shell =
if config.programs.fish.enable then
"fish"
else if config.programs.zsh.enable then
"zsh"
else
"bash";
};
zellij.enable = cfg.terminal == "alacritty"; # alacritty has no terminal multiplexer built-in
# PDF reader
zathura.enable = true;
# Auto start sway
fish.loginShellInit =
lib.optionalString cfg.sway.autostart # fish
zsh.loginExtra =
lib.optionalString cfg.sway.autostart # sh
''
# Start Sway on login to TTY 1
if test "$(tty)" = /dev/tty1
if [ "$TTY" = /dev/tty1 ]; then
exec sway
end
fi
'';
};
services = {
@ -154,6 +157,63 @@ in
};
};
# Window Manager
programs.niri = {
package = pkgs.niri; # use nixpkgs' package instead of the flake's
settings = {
binds =
let
# Modifier key
mod = "Mod";
# Available workspaces (1..=9)
workspaces = lib.range 1 9;
# Run function for each workspace
perWorkspace = f: lib.mergeAttrsList (builtins.map f workspaces);
# alias for concatStringsSep
joinWith = lib.strings.concatStringsSep;
in
with config.lib.niri.actions;
{
# Open Terminal
"${mod}+Return".action.spawn =
if config.jhome.gui.terminal == "alacritty" then "alacritty" else config.jhome.gui.terminalCommand;
# Open menu
"${mod}+D".action =
spawn "${lib.getExe pkgs.fuzzel}" "--terminal"
"${joinWith " " config.jhome.gui.terminalCommand}";
# Close Window
"${mod}+Q".action = close-window;
# Fullscreen
"${mod}+F".action = fullscreen-window;
# Hotkey help menu
"${mod}+Shift+Slash".action = show-hotkey-overlay;
# Media Keys
"XF86AudioRaiseVolume" = {
action = spawn "${pkgs.avizo}/bin/volumectl" "up";
allow-when-locked = true;
};
"XF86AudioLowerVolume" = {
action = spawn "${pkgs.avizo}/bin/volumectl" "down";
allow-when-locked = true;
};
"XF86AudioMute" = {
action = spawn "${pkgs.avizo}/bin/volumectl" "toggle-mute";
allow-when-locked = true;
};
# FIXME: swaylock is missing so this doesn't work anyways
# Lock screen
# "XF86ScreenSaver".action = spawn "swaylock" "--image" "${cfg.background}";
# Screen brightness
"XF86MonBrightnessUp".action = spawn "${pkgs.avizo}/bin/lightctl" "up";
"XF86MonBrightnessDown".action = spawn "${pkgs.avizo}/bin/lightctl" "down";
}
// perWorkspace (workspace: {
# Focus workspace N
"${mod}+${builtins.toString workspace}".action = focus-workspace workspace;
});
};
};
# Set cursor style
stylix = lib.mkIf config.jhome.styling.enable { inherit cursor; };
home.pointerCursor = lib.mkIf config.jhome.styling.enable (

118
home/gui/keybindings.nix Normal file
View file

@ -0,0 +1,118 @@
{ pkgs, config }:
let
cfg = config.jhome.gui.sway;
passmenu = "${pkgs.jpassmenu}/bin/jpassmenu";
selectAudio = "${pkgs.audiomenu}/bin/audiomenu";
swayconf = config.wayland.windowManager.sway.config;
mod = swayconf.modifier;
workspaces = map toString [
1
2
3
4
5
6
7
8
9
];
dirs =
map
(dir: {
key = swayconf.${dir};
arrow = dir;
direction = dir;
})
[
"up"
"down"
"left"
"right"
];
joinKeys = builtins.concatStringsSep "+";
# Generate a keybind from a modifier prefix and a key
keycombo = prefix: key: joinKeys (prefix ++ [ key ]);
modKeybind = keycombo [ mod ];
modCtrlKeybind = keycombo [
mod
"Ctrl"
];
modShiftKeybind = keycombo [
mod
"Shift"
];
modCtrlShiftKeybind = keycombo [
mod
"Ctrl"
"Shift"
];
dir2resize.up = "resize grow height";
dir2resize.down = "resize shrink height";
dir2resize.right = "resize grow width";
dir2resize.left = "resize shrink width";
# Bind a key combo to an action
genKeybind = prefix: action: key: { "${prefix key}" = "${action key}"; };
genKey =
prefix: action: genKeybind ({ key, ... }: prefix key) ({ direction, ... }: action direction);
genArrow =
prefix: action: genKeybind ({ arrow, ... }: prefix arrow) ({ direction, ... }: action direction);
genArrowAndKey =
prefix: action: key:
(genKey prefix action key) // (genArrow prefix action key);
# Move window
moveWindowKeybinds = map (genArrowAndKey modShiftKeybind (dir: "move ${dir}")) dirs;
# Focus window
focusWindowKeybinds = map (genArrowAndKey modKeybind (dir: "focus ${dir}")) dirs;
# Resize window
resizeWindowKeybinds = map (genArrowAndKey modCtrlKeybind (dir: dir2resize.${dir})) dirs;
# Move container to workspace
moveWorkspaceKeybindings = map (genKeybind modShiftKeybind (
number: "move container to workspace number ${number}"
)) workspaces;
# Focus workspace
focusWorkspaceKeybindings = map (genKeybind modKeybind (
number: "workspace number ${number}"
)) workspaces;
# Move container to Workspace and focus on it
moveFocusWorkspaceKeybindings = map (genKeybind modCtrlShiftKeybind (
number: "move container to workspace number ${number}; workspace number ${number}"
)) workspaces;
in
builtins.foldl' (l: r: l // r)
{
"${mod}+Return" = "exec ${swayconf.terminal}";
"${mod}+D" = "exec ${swayconf.menu}";
"${mod}+P" = "exec ${passmenu}";
"${mod}+Shift+P" = "exec ${passmenu} --type";
"${mod}+F2" = "exec qutebrowser";
"${mod}+Shift+Q" = "kill";
"${mod}+F" = "fullscreen toggle";
# Media Controls
"${mod}+F10" = "exec ${selectAudio} select-sink";
"${mod}+Shift+F10" = "exec ${selectAudio} select-source";
"XF86AudioRaiseVolume" = "exec ${pkgs.avizo}/bin/volumectl up";
"XF86AudioLowerVolume" = "exec ${pkgs.avizo}/bin/volumectl down";
"XF86AudioMute" = "exec ${pkgs.avizo}/bin/volumectl toggle-mute";
"XF86ScreenSaver" = "exec swaylock --image ${cfg.background}";
"XF86MonBrightnessUp" = "exec ${pkgs.avizo}/bin/lightctl up";
"XF86MonBrightnessDown" = "exec ${pkgs.avizo}/bin/lightctl down";
# Floating
"${mod}+Space" = "floating toggle";
"${mod}+Shift+Space" = "focus mode_toggle";
# Scratchpad
"${mod}+Minus" = "scratchpad show";
"${mod}+Shift+Minus" = "move scratchpad";
# Layout
"${mod}+e" = "layout toggle split";
# Session control
"${mod}+r" = "reload";
"${mod}+Shift+m" = "exit";
}
(
focusWindowKeybinds
++ moveWindowKeybinds
++ resizeWindowKeybinds
++ focusWorkspaceKeybindings
++ moveWorkspaceKeybindings
++ moveFocusWorkspaceKeybindings
)

95
home/gui/sway-config.nix Normal file
View file

@ -0,0 +1,95 @@
{ config, pkgs }:
let
cfg = config.jhome.gui.sway;
modifier = "Mod4";
termCmd = builtins.concatStringsSep " " config.jhome.gui.terminalCommand;
menu = "${pkgs.fuzzel}/bin/fuzzel --terminal '${termCmd}'";
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
# the suggested way to set gtk settings is with gsettings
# for gsettings to work, we need to tell it where the schemas are
# using the XDG_DATA_DIR environment variable
# run at the end of sway config
configure-gtk =
let
schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in
pkgs.writers.writeDashBin "configure-gtk" ''
export XDG_DATA_DIRS="${datadir}:$XDG_DATA_DIRS"
gnome_schema=org.gnome.desktop.interface
config="${config.xdg.configHome}/gtk-3.0/settings.ini"
if [ ! -f "$config" ]; then exit 1; fi
# Read settings from gtk3
gtk_theme="$(${pkgs.gnugrep}/bin/grep 'gtk-theme-name' "$config" | ${pkgs.gnused}/bin/sed 's/.*\s*=\s*//')"
icon_theme="$(${pkgs.gnugrep}/bin/grep 'gtk-icon-theme-name' "$config" | ${pkgs.gnused}/bin/sed 's/.*\s*=\s*//')"
cursor_theme="$(${pkgs.gnugrep}/bin/grep 'gtk-cursor-theme-name' "$config" | ${pkgs.gnused}/bin/sed 's/.*\s*=\s*//')"
font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')"
${pkgs.glib}/bin/gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
${pkgs.glib}/bin/gsettings set "$gnome_schema" icon-theme "$icon_theme"
${pkgs.glib}/bin/gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name"
${pkgs.glib}/bin/gsettings set "$gnome_schema" color-scheme prefer-dark
'';
cmdOnce = command: { inherit command; };
cmdAlways = command: {
inherit command;
always = true;
};
in
{
inherit (config.jhome.gui) terminal;
inherit modifier menu;
keybindings = import ./keybindings.nix { inherit config pkgs; };
# Appearance
bars = [ ]; # Waybar is started as a systemd service
gaps = {
smartGaps = true;
smartBorders = "on";
inner = 4;
};
output."*".bg = "${cfg.background} fill";
# Window Appearance
window = {
border = 2;
titlebar = false;
# Make certain windows floating
commands = [
{
command = "floating enable";
criteria.title = "zoom";
}
{
command = "floating enable";
criteria.class = "floating";
}
{
command = "floating enable";
criteria.app_id = "floating";
}
];
};
# Startup scripts
startup =
[
(cmdAlways "${configure-gtk}/bin/configure-gtk")
]
++ (builtins.map cmdAlways cfg.exec.always)
++ (builtins.map cmdOnce cfg.exec.once);
# Keyboard configuration
input."type:keyboard" = {
repeat_delay = "300";
repeat_rate = "50";
xkb_options = "caps:swapescape,compose:ralt";
xkb_numlock = "enabled";
};
# Touchpad
input."type:touchpad" = {
click_method = "clickfinger";
natural_scroll = "enabled";
scroll_method = "two_finger";
tap = "enabled";
tap_button_map = "lrm";
};
}

View file

@ -0,0 +1,127 @@
{ config, lib }:
let
cfg = config.jhome.gui;
in
{
mainBar = {
layer = "top";
position = "top";
margin = "2 2 2 2";
# Choose the order of the modules
modules-left = [ "sway/workspaces" ];
modules-center = [ "clock" ];
modules-right =
[
"pulseaudio"
"backlight"
"battery"
"sway/language"
"memory"
]
++ lib.optional (cfg.tempInfo != null) "temperature"
++ [ "tray" ];
"sway/workspaces" = {
disable-scroll = true;
persistent-workspaces = {
"1" = [ ];
"2" = [ ];
"3" = [ ];
"4" = [ ];
"5" = [ ];
"6" = [ ];
"7" = [ ];
"8" = [ ];
"9" = [ ];
};
};
"sway/language" = {
format = "{} ";
min-length = 5;
tooltip = false;
};
memory = {
format = "{used:0.1f}/{total:0.1f}GiB ";
interval = 3;
};
clock = {
timezone = "Europe/Berlin";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
format = "{:%a, %d %b, %H:%M}";
};
pulseaudio = {
reverse-scrolling = 1;
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = "{volume}% 󰖁 {icon} {format_source}";
format-muted = "{volume}% 󰖁 {format_source}";
format-source = "{volume}% ";
format-source-muted = "{volume}% 󰍭";
format-icons = {
headphone = "󰋋";
hands-free = "";
headset = "󰋎";
phone = "󰘂";
portable = "";
car = "";
default = [
"󰕿"
"󰖀"
"󰕾"
];
};
on-click = "pavucontrol";
min-length = 13;
};
temperature = lib.optionalAttrs (cfg.tempInfo != null) {
inherit (cfg.tempInfo) hwmon-path;
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = [
""
""
""
""
""
];
tooltip = false;
};
backlight = {
device = "intel_backlight";
format = "{percent}% {icon}";
format-icons = [
"󰃚"
"󰃛"
"󰃜"
"󰃝"
"󰃞"
"󰃟"
"󰃠"
];
min-length = 7;
};
battery = {
states.warning = 30;
states.critical = 15;
format = "{capacity}% {icon}";
format-charging = "{capacity}% 󰂄";
format-plugged = "{capacity}% 󰚥";
format-alt = "{time} {icon}";
format-icons = [
"󰁺"
"󰁻"
"󰁼"
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
};
tray = {
icon-size = 16;
spacing = 0;
};
};
}

View file

@ -78,13 +78,23 @@ let
example = "/sys/class/hwmon/hwmon2/temp1_input";
};
sway.options = {
enable = lib.mkEnableOption "sway" // {
windowManager.options = {
enable = lib.mkEnableOption "window manager" // {
default = fromConfig [
"gui"
"sway"
"windowManager"
"enable"
] true;
};
windowManager = lib.mkOption {
description = "Which window manager to enable";
type = types.enum [ "niri" ];
default = fromConfig [
"gui"
"windowManager"
"windowManager"
] "niri";
};
background = lib.mkOption {
description = "The wallpaper to use.";
type = types.path;
@ -114,29 +124,13 @@ let
default = true;
example = false;
};
exec = lib.mkOption {
description = "Run commands when starting sway.";
default = { };
type = types.submodule {
options = {
once = lib.mkOption {
description = "Programs to start only once (`exec`).";
type = types.listOf types.str;
default = [ ];
example = [ "signal-desktop --start-in-tray" ];
};
always = lib.mkOption {
description = "Programs to start whenever the config is sourced (`exec_always`).";
type = types.listOf types.str;
default = [ ];
example = [ "signal-desktop --start-in-tray" ];
};
};
};
};
};
gui.options = {
gui.options =
let
cfg = attrs.config.jhome.gui;
in
{
enable = lib.mkEnableOption "GUI applications" // {
default = fromConfig [
"gui"
@ -148,10 +142,10 @@ let
default = null;
type = types.nullOr (types.submodule tempInfo);
};
sway = lib.mkOption {
description = "Sway window manager configuration.";
windowManager = lib.mkOption {
description = "Window manager configuration.";
default = { };
type = types.submodule sway;
type = types.submodule windowManager;
};
terminal = lib.mkOption {
description = "The terminal emulator to use.";
@ -162,6 +156,27 @@ let
"alacritty"
];
};
terminalCommand = lib.mkOption {
description = "The command to run in order to start the terminal.";
default =
if cfg.terminal == "wezterm" then
[
"wezterm"
"start"
]
else if cfg.terminal == "alacritty" then
[
"alacritty"
"-e"
]
else
builtins.abort "no command configured for ${cfg.terminal}";
example = [
"wezterm"
"start"
];
type = types.listOf types.str;
};
};
in
{
@ -198,6 +213,8 @@ in
[ "just" ] # just a command runner
[ "typos" ] # low false positive rate typo checker
[ "gcc" ] # GNU Compiler Collection
[ "git-absorb" ] # fixup! but automatic
[ "gitoxide" ] # git but RiiR
[ "man-pages" ] # gimme the man pages
[ "man-pages-posix" ] # I said gimme the man pages!!!
];

View file

@ -4,12 +4,15 @@ let
inherit (cfg.defaultIdentity) signingKey;
cfg = jhome.user;
hasConfig = jhome.enable && cfg != null;
hasKey = signingKey != null;
gpgHome = config.programs.gpg.homedir;
unlockKey = hasConfig && cfg.gpg.unlockKeys != [ ];
in
{
config = lib.mkIf (jhome.enable && cfg != null) {
programs = {
git = {
config = lib.mkMerge [
(lib.mkIf hasConfig {
programs.git = {
userName = cfg.defaultIdentity.name;
userEmail = cfg.defaultIdentity.email;
signing = lib.mkIf hasKey {
@ -17,24 +20,22 @@ in
key = signingKey;
};
};
jujutsu.settings = {
programs.jujutsu.settings = {
user = lib.mkIf (cfg.defaultIdentity != null) { inherit (cfg.defaultIdentity) name email; };
git.sign-on-push = lib.mkDefault hasKey;
signing = lib.mkIf hasKey {
behaviour = "own";
sign-all = true;
backend = "gpg";
key = signingKey;
};
};
};
})
(lib.mkIf unlockKey {
xdg.configFile.pam-gnupg.text =
''
${gpgHome}
xdg.configFile.pam-gnupg = lib.mkIf (cfg.gpg.unlockKeys != [ ]) {
text = ''
${config.programs.gpg.homedir}
${lib.strings.concatLines cfg.gpg.unlockKeys}
'';
};
};
''
+ (lib.strings.concatLines cfg.gpg.unlockKeys);
})
];
}

View file

@ -3,18 +3,20 @@ default:
# Update a specific flake input
update input:
nix flake lock --update-input "{{input}}" --commit-lock-file
nix flake lock --update-input {{input}} --commit-lock-file
build-vm:
nixos-rebuild build-vm --fallback --flake .#vm --print-build-logs
nixos-rebuild build-vm --flake .#vm --print-build-logs
run-vm: build-vm
QEMU_OPTS="$QEMU_OPTS_WL" result/bin/run-nixos-vm
update-vim-plugins:
#!/bin/sh
plugindir=./modules/nixvim/extraPlugins
# Use local nixpkgs if available
nixpkgs="$HOME/Dev/nixpkgs"
# copy nixpkgs from local checkout
if [ ! -d "$nixpkgs" ]; then
nixpkgs="$(mktemp -d)"
cp -r /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/. "$nixpkgs"
cd "$nixpkgs"
@ -22,10 +24,11 @@ update-vim-plugins:
git add .
git commit -m 'dummy commit'
cd -
fi
# update vim plugins
nix run nixpkgs#vimPluginsUpdater -- --proc=1 --nixpkgs "$nixpkgs" --no-commit -i "$plugindir/plugins" -o "$plugindir/generated.nix" update
nix run nixpkgs#vimPluginsUpdater -- --proc=1 --nixpkgs "$nixpkgs" --no-commit -i ./nvim/extraPlugins/plugins -o ./nvim/extraPlugins/generated.nix update
# format the generated output
nix fmt "$plugindir/generated.nix"
nix fmt ./nvim/extraPlugins/generated.nix
# Amend Update flake.lock PR
flake-pr:

31
machines/vm/default.nix Normal file
View file

@ -0,0 +1,31 @@
{
services.qemuGuest.enable = true;
boot.initrd.availableKernelModules = [
"xhci_pci"
"ehci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
"virtio_balloon"
"virtio_blk"
"virtio_pci"
"virtio_ring"
# "virtio_vga"
"virtio_gpu"
];
fileSystems."/".device = "/dev/disk/by-label/nixos";
boot.loader.systemd-boot.enable = true;
services.openssh.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
}

View file

@ -1,139 +0,0 @@
{
config,
pkgs,
lib,
osConfig ? null,
...
}:
let
cfg = config.jhome;
devcfg = cfg.dev;
# Query the osConfig for a setting. Return the default value if missing or in standalone mode
fromOs =
path: default: if osConfig == null then default else lib.attrsets.attrByPath path default osConfig;
in
{
imports = [
./options.nix
./gui
./dev.nix
./users.nix
];
config = lib.mkMerge [
(lib.mkIf (cfg.enable && cfg.styling.enable) {
stylix = {
enable = true;
targets.nixvim.enable = false; # I prefer styling it myself
};
})
(lib.mkIf cfg.enable {
# Add gopass if pass is enabled
home.packages = lib.optional config.programs.password-store.enable pkgs.gopass;
nix.settings.use-xdg-base-directories = fromOs [
"nix"
"settings"
"use-xdg-base-directories"
] true;
programs = {
# Better cat (bat)
bat = {
enable = true;
config = {
# Disable headers and numbers
style = "plain";
theme = lib.mkForce "gruvbox-dark";
};
};
# Direnv
direnv = {
enable = true;
nix-direnv.enable = true;
};
# ls replacement
eza = {
enable = true;
git = true;
icons = "auto";
};
# Shell
bash.enable = true; # ensure HM variables are passed to `bash` too (otherwise `jpassmenu` doesn't work)
fish = {
enable = true;
preferAbbrs = true; # when defining an alias, prefer instead to define an abbreviation
};
# GnuPG
gpg = {
enable = true;
homedir = "${config.xdg.dataHome}/gnupg";
};
# Mail client
himalaya.enable = lib.mkDefault true;
# Password manager
password-store = {
enable = lib.mkDefault true;
package = pkgs.pass-nodmenu;
settings.PASSWORD_STORE_DIR = "${config.xdg.dataHome}/pass";
};
# SSH
ssh.enable = true;
# cd replacement
zoxide.enable = true;
};
services = {
# GPG Agent
gpg-agent = {
enable = true;
maxCacheTtl = 86400;
pinentryPackage = if config.jhome.gui.enable then pkgs.pinentry-qt else pkgs.pinentry-curses;
extraConfig = "allow-preset-passphrase";
};
# Spotifyd
spotifyd = {
inherit (config.jhome.gui) enable;
settings.global = {
device_name = config.jhome.hostName;
device_type = "computer";
backend = "pulseaudio";
zeroconf_port = 2020;
};
};
};
home = {
# Extra variables
sessionVariables = {
CARGO_HOME = "${config.xdg.dataHome}/cargo";
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
GOPATH = "${config.xdg.dataHome}/go";
};
shellAliases = {
# Verbose Commands
cp = "cp --verbose";
ln = "ln --verbose";
mv = "mv --verbose";
mkdir = "mkdir --verbose";
rename = "rename --verbose";
rm = "rm --verbose";
# Add Color
grep = "grep --color=auto";
ip = "ip --color=auto";
# Use exa/eza
tree = "eza --tree";
};
};
# XDG directories
xdg = {
enable = true;
userDirs = {
enable = true;
createDirectories = true;
};
};
})
];
}

View file

@ -1,91 +0,0 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.jhome.dev;
in
{
config =
lib.flip lib.pipe
[
lib.mkMerge
(lib.mkIf (config.jhome.enable && cfg.enable))
]
[
(lib.mkIf cfg.rust.enable {
home.packages = [ pkgs.rustup ] ++ cfg.rust.extraPackages;
})
{
home = {
sessionVariables.MANPAGER = lib.optionalString cfg.neovimAsManPager "nvim -c 'Man!' -o -";
packages = cfg.extraPackages;
};
# Github CLI
programs = {
gh.enable = true;
gh-dash.enable = true;
# Git
git = {
enable = true;
difftastic = {
enable = true;
background = "dark";
};
lfs.enable = true;
extraConfig = {
# Add diff to the commit message editor
commit.verbose = true;
# Improve submodule diff
diff.submodule = "log";
# Set the default branch name for new branches
init.defaultBranch = "main";
# Better conflicts (also shows parent commit state)
merge.conflictStyle = "zdiff3";
# Do not create merge commits when pulling (rebase but abort on conflict)
pull.ff = "only";
# Use `--set-upstream` if the remote does not have the branch
push.autoSetupRemote = true;
rebase = {
# If there are uncommitted changes, stash them before rebasing
autoStash = true;
# If there are fixup! commits, squash them while rebasing
autoSquash = true;
};
# Enable ReReRe (Reuse Recovered Resolution) auto resolve previously resolved conflicts
rerere.enabled = true;
# Improve submodule status
status.submoduleSummary = true;
};
};
lazygit.enable = true;
# Jujutsu (alternative DVCS (git-compatible))
jujutsu = {
enable = true;
package = pkgs.unstable.jujutsu;
settings = {
ui.pager = "bat";
# mimic git commit --verbose by adding a diff
templates.draft_commit_description = ''
concat(
description,
"\n",
surround(
"\nJJ: This commit contains the following changes:\n", "",
indent("JJ: ", diff.summary()),
),
surround(
"JJ: ignore-rest\n", "",
diff.git(),
),
)
'';
};
};
};
}
];
}

View file

@ -1,226 +0,0 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.jhome.gui.sway;
in
{
config = lib.mkIf (config.jhome.enable && config.jhome.gui.enable && cfg.enable) {
# Window Manager
wayland.windowManager.sway = {
inherit (cfg) enable;
config =
let
inherit (config.jhome.gui) terminal;
termCmd =
if terminal == "wezterm" then
"wezterm start"
else if terminal == "alacritty" then
"alacritty -e"
else
builtins.abort "no command configured for ${terminal}";
menu = "${pkgs.fuzzel}/bin/fuzzel --terminal '${termCmd}'";
cmdOnce = command: { inherit command; };
cmdAlways = command: {
inherit command;
always = true;
};
in
{
modifier = "Mod4";
inherit terminal menu;
# Appearance
bars = [ ]; # Waybar is started as a systemd service
gaps = {
smartGaps = true;
smartBorders = "on";
inner = 4;
};
output."*".bg = "${cfg.background} fill";
# Window Appearance
window = {
border = 2;
titlebar = false;
# Make certain windows floating
commands = [
{
command = "floating enable";
criteria.title = "zoom";
}
{
command = "floating enable";
criteria.class = "floating";
}
{
command = "floating enable";
criteria.app_id = "floating";
}
];
};
# Startup scripts
startup =
let
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
# the suggested way to set gtk settings is with gsettings
# for gsettings to work, we need to tell it where the schemas are
# using the XDG_DATA_DIR environment variable
# run at the end of sway config
schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in
[
(cmdAlways "${pkgs.writers.writeDash "configure-gtk" ''
export XDG_DATA_DIRS="${datadir}:$XDG_DATA_DIRS"
gnome_schema=org.gnome.desktop.interface
config="${config.xdg.configHome}/gtk-3.0/settings.ini"
if [ ! -f "$config" ]; then exit 1; fi
# Read settings from gtk3
gtk_theme="$(${pkgs.gnugrep}/bin/grep 'gtk-theme-name' "$config" | ${pkgs.gnused}/bin/sed 's/.*\s*=\s*//')"
icon_theme="$(${pkgs.gnugrep}/bin/grep 'gtk-icon-theme-name' "$config" | ${pkgs.gnused}/bin/sed 's/.*\s*=\s*//')"
cursor_theme="$(${pkgs.gnugrep}/bin/grep 'gtk-cursor-theme-name' "$config" | ${pkgs.gnused}/bin/sed 's/.*\s*=\s*//')"
font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')"
${pkgs.glib}/bin/gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
${pkgs.glib}/bin/gsettings set "$gnome_schema" icon-theme "$icon_theme"
${pkgs.glib}/bin/gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name"
${pkgs.glib}/bin/gsettings set "$gnome_schema" color-scheme prefer-dark
''}")
]
++ (builtins.map cmdAlways cfg.exec.always)
++ (builtins.map cmdOnce cfg.exec.once);
# Keyboard configuration
input."type:keyboard" = {
repeat_delay = "300";
repeat_rate = "50";
xkb_options = "caps:swapescape,compose:ralt";
xkb_numlock = "enabled";
};
# Touchpad
input."type:touchpad" = {
click_method = "clickfinger";
natural_scroll = "enabled";
scroll_method = "two_finger";
tap = "enabled";
tap_button_map = "lrm";
};
# Keybinds
keybindings =
let
passmenu = "${pkgs.jpassmenu}/bin/jpassmenu";
selectAudio = "${pkgs.audiomenu}/bin/audiomenu";
swayconf = config.wayland.windowManager.sway.config;
mod = swayconf.modifier;
workspaces = map toString (lib.lists.range 1 9);
dirs =
map
(dir: {
key = swayconf.${dir};
arrow = dir;
direction = dir;
})
[
"up"
"down"
"left"
"right"
];
joinKeys = builtins.concatStringsSep "+";
# Generate a keybind from a modifier prefix and a key
keycombo = prefix: key: joinKeys (prefix ++ [ key ]);
modKeybind = keycombo [ mod ];
modCtrlKeybind = keycombo [
mod
"Ctrl"
];
modShiftKeybind = keycombo [
mod
"Shift"
];
modCtrlShiftKeybind = keycombo [
mod
"Ctrl"
"Shift"
];
dir2resize.up = "resize grow height";
dir2resize.down = "resize shrink height";
dir2resize.right = "resize grow width";
dir2resize.left = "resize shrink width";
# Bind a key combo to an action
genKeybind = prefix: action: key: { "${prefix key}" = "${action key}"; };
genKey =
prefix: action: genKeybind ({ key, ... }: prefix key) ({ direction, ... }: action direction);
genArrow =
prefix: action: genKeybind ({ arrow, ... }: prefix arrow) ({ direction, ... }: action direction);
genArrowAndKey =
prefix: action: key:
(genKey prefix action key) // (genArrow prefix action key);
# Move window
moveWindowKeybinds = map (genArrowAndKey modShiftKeybind (dir: "move ${dir}")) dirs;
# Focus window
focusWindowKeybinds = map (genArrowAndKey modKeybind (dir: "focus ${dir}")) dirs;
# Resize window
resizeWindowKeybinds = map (genArrowAndKey modCtrlKeybind (dir: dir2resize.${dir})) dirs;
# Move container to workspace
moveWorkspaceKeybindings = map (genKeybind modShiftKeybind (
number: "move container to workspace number ${number}"
)) workspaces;
# Focus workspace
focusWorkspaceKeybindings = map (genKeybind modKeybind (
number: "workspace number ${number}"
)) workspaces;
# Move container to Workspace and focus on it
moveFocusWorkspaceKeybindings = map (genKeybind modCtrlShiftKeybind (
number: "move container to workspace number ${number}; workspace number ${number}"
)) workspaces;
in
builtins.foldl' (l: r: l // r)
{
"${mod}+Return" = "exec ${swayconf.terminal}";
"${mod}+D" = "exec ${swayconf.menu}";
"${mod}+P" = "exec ${passmenu}";
"${mod}+Shift+P" = "exec ${passmenu} --type";
"${mod}+F2" = "exec qutebrowser";
"${mod}+Shift+Q" = "kill";
"${mod}+F" = "fullscreen toggle";
# Media Controls
"${mod}+F10" = "exec ${selectAudio} select-sink";
"${mod}+Shift+F10" = "exec ${selectAudio} select-source";
"XF86AudioRaiseVolume" = "exec ${pkgs.avizo}/bin/volumectl up";
"XF86AudioLowerVolume" = "exec ${pkgs.avizo}/bin/volumectl down";
"XF86AudioMute" = "exec ${pkgs.avizo}/bin/volumectl toggle-mute";
"XF86ScreenSaver" = "exec ${pkgs.swaylock}/bin/swaylock --image ${cfg.background}";
"XF86MonBrightnessUp" = "exec ${pkgs.avizo}/bin/lightctl up";
"XF86MonBrightnessDown" = "exec ${pkgs.avizo}/bin/lightctl down";
# Floating
"${mod}+Space" = "floating toggle";
"${mod}+Shift+Space" = "focus mode_toggle";
# Scratchpad
"${mod}+Minus" = "scratchpad show";
"${mod}+Shift+Minus" = "move scratchpad";
# Layout
"${mod}+e" = "layout toggle split";
# Session control
"${mod}+r" = "reload";
"${mod}+Shift+m" = "exit";
}
(
focusWindowKeybinds
++ moveWindowKeybinds
++ resizeWindowKeybinds
++ focusWorkspaceKeybindings
++ moveWorkspaceKeybindings
++ moveFocusWorkspaceKeybindings
);
};
systemd = {
enable = true;
xdgAutostart = true;
};
};
};
}

View file

@ -1,159 +0,0 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (config) jhome;
cfg = jhome.gui;
swayconf = config.wayland.windowManager.sway;
in
{
config = lib.mkIf (config.jhome.enable && cfg.enable) {
# Status bar
programs.waybar = {
enable = true;
systemd.enable = true;
settings = lib.mkIf config.jhome.styling.enable {
mainBar = {
layer = "top";
position = "top";
margin = "2 2 2 2";
# Choose the order of the modules
modules-left = [ "sway/workspaces" ];
modules-center = [ "clock" ];
modules-right =
[
"pulseaudio"
"backlight"
"battery"
"sway/language"
"memory"
]
++ lib.optional (cfg.tempInfo != null) "temperature"
++ [ "tray" ];
"sway/workspaces" = lib.mkIf swayconf.enable {
disable-scroll = true;
persistent-workspaces = {
"1" = [ ];
"2" = [ ];
"3" = [ ];
"4" = [ ];
"5" = [ ];
"6" = [ ];
"7" = [ ];
"8" = [ ];
"9" = [ ];
};
};
"sway/language" = lib.mkIf swayconf.enable {
format = "{} ";
min-length = 5;
tooltip = false;
};
memory = {
format = "{used:0.1f}/{total:0.1f}GiB ";
interval = 3;
};
clock = {
timezone = "Europe/Berlin";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
format = "{:%a, %d %b, %H:%M}";
};
wireplumber = {
reverse-scrolling = 1;
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = "{volume}% 󰖁 {icon} {format_source}";
format-muted = "{volume}% 󰖁 {format_source}";
format-source = "{volume}% ";
format-source-muted = "{volume}% 󰍭";
format-icons = {
headphone = "󰋋";
hands-free = "";
headset = "󰋎";
phone = "󰘂";
portable = "";
car = "";
default = [
"󰕿"
"󰖀"
"󰕾"
];
};
on-click = lib.getExe pkgs.helvum;
min-length = 13;
};
temperature = lib.optionalAttrs (cfg.tempInfo != null) {
inherit (cfg.tempInfo) hwmon-path;
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = [
""
""
""
""
""
];
tooltip = false;
};
backlight = {
device = "intel_backlight";
format = "{percent}% {icon}";
format-icons = [
"󰃚"
"󰃛"
"󰃜"
"󰃝"
"󰃞"
"󰃟"
"󰃠"
];
min-length = 7;
};
battery = {
states.warning = 30;
states.critical = 15;
format = "{capacity}% {icon}";
format-charging = "{capacity}% 󰂄";
format-plugged = "{capacity}% 󰚥";
format-alt = "{time} {icon}";
format-icons = [
"󰁺"
"󰁻"
"󰁼"
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
};
tray = {
icon-size = 16;
spacing = 0;
};
};
};
# Style overrides to highlight workspaces with windows
style =
lib.pipe
# css
''
.modules-left #workspaces button {
border-bottom: 3px solid @base01;
}
.modules-left #workspaces button.persistent {
border-bottom: 3px solid transparent;
}
''
[
(lib.optionalString config.jhome.styling.enable)
lib.mkAfter
];
};
};
}

View file

@ -1,27 +0,0 @@
{ lib }:
let
inherit (lib) types;
in
{
# Like mkEnableOption but defaults to true
mkDisableOption =
option:
(lib.mkEnableOption option)
// {
default = true;
example = false;
};
# A option that accepts an image (and shows it in the docs)
mkImageOption =
{
description,
url,
sha256 ? "",
}:
lib.mkOption {
inherit description;
type = types.path;
default = builtins.fetchurl { inherit url sha256; };
defaultText = lib.literalMD "![${description}](${url})";
};
}

View file

@ -1,76 +0,0 @@
{ pkgs, lib, ... }@args:
let
cfg = args.config.jconfig;
keysFromGithub = lib.attrsets.mapAttrs' (username: sha256: {
name = "pubkeys/${username}";
value = {
mode = "0755";
source = builtins.fetchurl {
inherit sha256;
url = "https://github.com/${username}.keys";
};
};
}) cfg.importSSHKeysFromGithub;
in
{
imports = [
./options.nix
./dev.nix
./gui.nix
./starship.nix
./styling.nix
];
config = lib.mkIf cfg.enable {
# Enable unlocking the gpg-agent at boot (configured through home.nix)
security.pam.services.login.gnupg.enable = true;
environment.systemPackages = [
# CLI tools
pkgs.fd
pkgs.ripgrep
pkgs.du-dust
pkgs.curl
pkgs.zip
pkgs.unzip
];
programs.fish.enable = true;
environment.etc = keysFromGithub;
services = {
# Enable printer autodiscovery if printing is enabled
avahi = {
inherit (args.config.services.printing) enable;
nssmdns4 = true;
openFirewall = true;
};
openssh.authorizedKeysFiles = builtins.map (keys: "/etc/${keys}") (
builtins.attrNames keysFromGithub
);
};
# Open ports for spotifyd
networking.firewall = {
allowedUDPPorts = [ 5353 ];
allowedTCPPorts = [ 2020 ];
};
# Nix Settings
nix = {
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
# run between 0 and 45min after boot if run was missed
randomizedDelaySec = "45min";
};
settings = {
use-xdg-base-directories = true;
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
};
};
};
}

View file

@ -1,18 +0,0 @@
{ lib, config, ... }:
let
cfg = config.jconfig.dev;
in
{
config = lib.mkIf (config.jconfig.enable && cfg.enable) {
# Enable dev documentation
documentation.dev = { inherit (cfg) enable; };
users.extraUsers = lib.mkIf cfg.jupyter.enable { jupyter.group = "jupyter"; };
services.jupyter = {
inherit (cfg.jupyter) enable;
group = "jupyter";
user = "jupyter";
};
};
}

View file

@ -1,117 +0,0 @@
{ lib, pkgs, ... }@args:
let
cfg = args.config.jconfig.gui;
enable = args.config.jconfig.enable && cfg.enable;
linuxOlderThan6_3 = lib.versionOlder args.config.boot.kernelPackages.kernel.version "6.3";
in
{
config =
lib.flip lib.pipe
[ lib.mkMerge (lib.mkIf enable) ]
[
{
environment.systemPackages = [
pkgs.adwaita-icon-theme
pkgs.adwaita-qt
pkgs.nordzy-cursor-theme
pkgs.pinentry-qt
];
# Fix xdg-portals issue issue: https://github.com/NixOS/nixpkgs/issues/189851
systemd.user.extraConfig = ''
DefaultEnvironment="PATH=/run/wrappers/bin:/etc/profiles/per-user/%u/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
'';
fonts.fontDir.enable = true;
programs = {
dconf.enable = true;
sway = {
enable = cfg.sway;
# No extra packages (by default it adds foot, dmenu, and other stuff)
extraPackages = [ ];
wrapperFeatures = {
base = true;
gtk = true;
};
};
};
security = {
polkit.enable = true;
rtkit.enable = true; # Recommended for pipewire
};
services = {
flatpak.enable = true;
# Audio
pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
wireplumber.enable = true;
};
# Dbus
dbus.enable = true;
# Virtual Filesystem (for PCManFM)
gvfs.enable = true;
};
xdg.portal = {
# XDG portals
enable = true;
wlr.enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
config.preferred = {
# Default to the gtk portal
default = "gtk";
# Use wlr for screenshots and screen recording
"org.freedesktop.impl.portal.Screenshot" = "wlr";
};
# Consider using darkman like upstream
};
hardware = {
graphics.enable = true;
uinput.enable = true;
steam-hardware.enable = cfg.steamHardwareSupport;
};
}
(lib.mkIf cfg.ydotool.enable {
environment.systemPackages = [ pkgs.ydotool ];
systemd.user.services.ydotool = {
enable = cfg.ydotool.autoStart;
wantedBy = [ "default.target" ];
description = "Generic command-line automation tool";
documentation = [
"man:ydotool(1)"
"man:ydotoold(8)"
];
serviceConfig = {
Type = "simple";
Restart = "always";
ExecStart = "${pkgs.ydotool}/bin/ydotoold";
ExecReload = "${pkgs.util-linux}/bin/kill -HUP $MAINPID";
KillMode = "process";
TimeoutSec = 180;
};
};
})
(lib.mkIf (linuxOlderThan6_3 && cfg."8bitdoFix") {
# Udev rules to start or stop systemd service when controller is connected or disconnected
services.udev.extraRules = # udev
''
# May vary depending on your controller model, find product id using 'lsusb'
SUBSYSTEM=="usb", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3106", ATTR{manufacturer}=="8BitDo", RUN+="${pkgs.systemd}/bin/systemctl start 8bitdo-ultimate-xinput@2dc8:3106"
# This device (2dc8:3016) is "connected" when the above device disconnects
SUBSYSTEM=="usb", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3016", ATTR{manufacturer}=="8BitDo", RUN+="${pkgs.systemd}/bin/systemctl stop 8bitdo-ultimate-xinput@2dc8:3106"
'';
# Systemd service which starts xboxdrv in xbox360 mode
systemd.services."8bitdo-ultimate-xinput@" = {
unitConfig.Description = "8BitDo Ultimate Controller XInput mode xboxdrv daemon";
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.xboxdrv}/bin/xboxdrv --mimic-xpad --silent --type xbox360 --device-by-id %I --force-feedback";
};
};
})
];
}

View file

@ -1,95 +0,0 @@
{ lib, ... }:
let
inherit (lib) types;
inherit (import ../lib.nix { inherit lib; })
mkDisableOption
mkImageOption
;
in
{
options.jconfig = lib.mkOption {
description = "Jalil's default NixOS configuration.";
default = { };
type = types.submodule {
options = {
enable = lib.mkEnableOption "jalil's default configuration.";
importSSHKeysFromGithub = lib.mkOption {
description = ''
Import public ssh keys from a github username.
This will fetch the keys from https://github.com/$${username}.keys.
The format is `"$${github-username}" = $${sha256-hash}`. The example
will try to fetch the keys from <https://github.com/jalil-salame.keys>.
**Warning**: this will interfere with services like gitea that override
the default ssh behaviour. In that case you want to use
`users.users.<name>.openssh.authorizedKeys.keyFiles` on the users you
want to allow ssh logins.
'';
default = { };
example = {
"jalil-salame" = "sha256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
};
type = types.attrsOf types.str;
};
dev = lib.mkOption {
description = "Options for setting up a dev environment";
default = { };
type = types.submodule {
options = {
enable = lib.mkEnableOption "dev configuration";
jupyter.enable = lib.mkEnableOption "jupyter configuration";
};
};
};
gui = lib.mkOption {
description = "Jalil's default configuration for a NixOS gui.";
default = { };
type = types.submodule {
options = {
enable = lib.mkEnableOption "jalil's default gui configuration.";
# Fix for using Xinput mode on 8bitdo Ultimate C controller
# Inspired by https://aur.archlinux.org/packages/8bitdo-ultimate-controller-udev
# Adapted from: https://gist.github.com/interdependence/28452fbfbe692986934fbe1e54c920d4
"8bitdoFix" = mkDisableOption "a fix for 8bitdo controllers";
steamHardwareSupport = mkDisableOption "steam hardware support";
ydotool = lib.mkOption {
description = "Jalil's default ydotool configuration.";
default = { };
type = types.submodule {
options.enable = mkDisableOption "ydotool";
options.autoStart = mkDisableOption "autostarting ydotool at login";
};
};
sway = mkDisableOption "sway";
};
};
};
styling = lib.mkOption {
description = "Jalil's styling options";
default = { };
type = types.submodule {
options = {
enable = mkDisableOption "jalil's default styling (disables stylix)";
wallpaper = mkImageOption {
description = "The wallpaper to use.";
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
};
bootLogo = mkImageOption {
description = "The logo used by plymouth at boot.";
# http://xenia-linux-site.glitch.me/images/cathodegaytube-splash.png
url = "https://efimero.github.io/xenia-images/cathodegaytube-splash.png";
sha256 = "qKugUfdRNvMwSNah+YmMepY3Nj6mWlKFh7jlGlAQDo8=";
};
};
};
};
};
};
};
}

View file

@ -1,183 +0,0 @@
{ pkgs, lib, ... }@args:
let
cfg = args.config.jconfig;
in
{
config = lib.mkIf cfg.enable {
programs.starship = {
enable = true;
settings = lib.mkMerge [
{
format = "$time$all";
add_newline = false;
cmd_duration.min_time = 500;
cmd_duration.show_milliseconds = true;
time.disabled = false;
status = {
format = "[$signal_name$common_meaning$maybe_int](red)";
symbol = "[](bold red)";
disabled = false;
};
sudo.disabled = false;
}
# Add nerdfont symbols
(lib.mkIf cfg.styling.enable {
aws.symbol = " ";
buf.symbol = " ";
c.symbol = " ";
conda.symbol = " ";
crystal.symbol = " ";
dart.symbol = " ";
directory.read_only = " 󰌾";
docker_context.symbol = " ";
elixir.symbol = " ";
elm.symbol = " ";
fennel.symbol = " ";
fossil_branch.symbol = " ";
git_branch.symbol = " ";
git_commit.tag_symbol = " ";
golang.symbol = " ";
gradle.symbol = " ";
guix_shell.symbol = " ";
haskell.symbol = " ";
haxe.symbol = " ";
hg_branch.symbol = " ";
hostname.ssh_symbol = " ";
java.symbol = " ";
julia.symbol = " ";
kotlin.symbol = " ";
lua.symbol = " ";
memory_usage.symbol = "󰍛 ";
meson.symbol = "󰔷 ";
nim.symbol = "󰆥 ";
nix_shell.symbol = " ";
nodejs.symbol = " ";
ocaml.symbol = " ";
package.symbol = "󰏗 ";
perl.symbol = " ";
php.symbol = " ";
pijul_channel.symbol = " ";
python.symbol = " ";
rlang.symbol = "󰟔 ";
ruby.symbol = " ";
rust.symbol = "󱘗 ";
scala.symbol = " ";
swift.symbol = " ";
zig.symbol = " ";
os.symbols = {
Alpaquita = " ";
Alpine = " ";
AlmaLinux = " ";
Amazon = " ";
Android = " ";
Arch = " ";
Artix = " ";
CentOS = " ";
Debian = " ";
DragonFly = " ";
Emscripten = " ";
EndeavourOS = " ";
Fedora = " ";
FreeBSD = " ";
Garuda = "󰛓 ";
Gentoo = " ";
HardenedBSD = "󰞌 ";
Illumos = "󰈸 ";
Kali = " ";
Linux = " ";
Mabox = " ";
Macos = " ";
Manjaro = " ";
Mariner = " ";
MidnightBSD = " ";
Mint = " ";
NetBSD = " ";
NixOS = " ";
OpenBSD = "󰈺 ";
openSUSE = " ";
OracleLinux = "󰌷 ";
Pop = " ";
Raspbian = " ";
Redhat = " ";
RedHatEnterprise = " ";
RockyLinux = " ";
Redox = "󰀘 ";
Solus = "󰠳 ";
SUSE = " ";
Ubuntu = " ";
Unknown = " ";
Void = " ";
Windows = "󰍲 ";
};
})
# Remove the `in`s and `on`s from the prompt
{
aws.format = "[$symbol($profile)(\\($region\\))(\\[$duration\\])]($style) ";
bun.format = "[$symbol($version)]($style) ";
c.format = "[$symbol($version(-$name))]($style) ";
cmake.format = "[$symbol($version)]($style) ";
cmd_duration.format = "[ $duration]($style) ";
cobol.format = "[$symbol($version)]($style) ";
conda.format = "[$symbol$environment]($style) ";
crystal.format = "[$symbol($version)]($style) ";
daml.format = "[$symbol($version)]($style) ";
dart.format = "[$symbol($version)]($style) ";
deno.format = "[$symbol($version)]($style) ";
docker_context.format = "[$symbol$context]($style) ";
dotnet.format = "[$symbol($version)(🎯 $tfm)]($style) ";
elixir.format = "[$symbol($version \\(OTP $otp_version\\))]($style) ";
elm.format = "[$symbol($version)]($style) ";
erlang.format = "[$symbol($version)]($style) ";
fennel.format = "[$symbol($version)]($style) ";
fossil_branch.format = "[$symbol$branch]($style) ";
gcloud.format = "[$symbol$account(@$domain)(\\($region\\))]($style) ";
git_branch.format = "[$symbol$branch]($style) ";
git_status.format = "[$all_status$ahead_behind]($style) ";
golang.format = "[$symbol($version)]($style) ";
gradle.format = "[$symbol($version)]($style) ";
guix_shell.format = "[$symbol]($style) ";
haskell.format = "[$symbol($version)]($style) ";
haxe.format = "[$symbol($version)]($style) ";
helm.format = "[$symbol($version)]($style) ";
hg_branch.format = "[$symbol$branch]($style) ";
java.format = "[$symbol($version)]($style) ";
julia.format = "[$symbol($version)]($style) ";
kotlin.format = "[$symbol($version)]($style) ";
kubernetes.format = "[$symbol$context( \\($namespace\\))]($style) ";
lua.format = "[$symbol($version)]($style) ";
memory_usage.format = "$symbol[$ram( | $swap)]($style) ";
meson.format = "[$symbol$project]($style) ";
nim.format = "[$symbol($version)]($style) ";
nix_shell.format = "[$symbol$state( \\($name\\))]($style) ";
nodejs.format = "[$symbol($version)]($style) ";
ocaml.format = "[$symbol($version)(\\($switch_indicator$switch_name\\))]($style) ";
opa.format = "[$symbol($version)]($style) ";
openstack.format = "[$symbol$cloud(\\($project\\))]($style) ";
os.format = "[$symbol]($style) ";
package.format = "[$symbol$version]($style) ";
perl.format = "[$symbol($version)]($style) ";
php.format = "[$symbol($version)]($style) ";
pijul_channel.format = "[$symbol$channel]($style) ";
pulumi.format = "[$symbol$stack]($style) ";
purescript.format = "[$symbol($version)]($style) ";
python.format = "[\${symbol}\${pyenv_prefix}(\${version})(\\($virtualenv\\))]($style) ";
raku.format = "[$symbol($version-$vm_version)]($style) ";
red.format = "[$symbol($version)]($style) ";
ruby.format = "[$symbol($version)]($style) ";
rust.format = "[$symbol($version)]($style) ";
scala.format = "[$symbol($version)]($style) ";
spack.format = "[$symbol$environment]($style) ";
sudo.format = "[as $symbol]($style) ";
swift.format = "[$symbol($version)]($style) ";
terraform.format = "[$symbol$workspace]($style) ";
time.format = "[$time]($style) ";
username.format = "[$user]($style) ";
vagrant.format = "[$symbol($version)]($style) ";
vlang.format = "[$symbol($version)]($style) ";
zig.format = "[$symbol($version)]($style) ";
solidity.format = "[$symbol($version)]($style) ";
}
];
};
};
}

View file

@ -1,43 +0,0 @@
{ lib, pkgs, ... }@args:
let
cfg = args.config.jconfig.styling;
enable = args.config.jconfig.enable && cfg.enable;
in
{
config = lib.mkIf enable {
boot.plymouth = { inherit (cfg) enable; };
stylix = {
inherit (cfg) enable;
image = cfg.wallpaper;
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
polarity = "dark";
fonts = {
monospace = {
name = "JetBrains Mono";
package = pkgs.jetbrains-mono;
};
sansSerif = {
name = "Noto Sans";
package = pkgs.noto-fonts;
};
serif = {
name = "Noto Serif";
package = pkgs.noto-fonts;
};
emoji = {
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
sizes.popups = 12;
};
targets = {
plymouth = {
logoAnimated = false;
logo = cfg.bootLogo;
};
nixvim.enable = false;
};
};
};
}

View file

@ -1,151 +0,0 @@
{ lib, helpers, ... }:
let
inherit (helpers) mkRaw;
in
{
config.plugins = {
cmp =
let
srcWithIndex = groupIndex: name: { inherit name groupIndex; };
in
{
enable = true;
cmdline = {
"/" = {
mapping =
mkRaw
# lua
''
cmp.mapping.preset.cmdline()
'';
sources = [
{ name = "rg"; }
{ name = "buffer"; }
];
};
":" = {
mapping =
mkRaw
# lua
"cmp.mapping.preset.cmdline()";
sources = [
{ name = "path"; }
{ name = "cmdline"; }
];
};
};
settings = {
# Snippets
snippet.expand =
# lua
"function(args) require('luasnip').lsp_expand(args.body) end";
# Completion Sources
sources = [
# very specific (not noisy)
(srcWithIndex 1 "calc")
(srcWithIndex 1 "crates")
(srcWithIndex 1 "fish")
(srcWithIndex 1 "luasnip")
(srcWithIndex 1 "nvim_lsp")
# Generally ok
(srcWithIndex 2 "conventionalcommits")
(srcWithIndex 2 "nvim_lsp_document_symbol")
(srcWithIndex 2 "nvim_lsp_signature_help")
# Noisy
(srcWithIndex 2 "path")
(srcWithIndex 3 "spell")
(srcWithIndex 3 "treesitter")
# Very noisy
(srcWithIndex 4 "buffer")
];
mapping =
mkRaw
# lua
''
cmp.mapping.preset.insert({
["<C-n>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end,
["<C-p>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end,
["<C-u>"] = cmp.mapping(function(fallback)
if require("luasnip").choice_active() then
require("luasnip").next_choice()
else
fallback()
end
end),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete { },
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm { select = true },
})
'';
};
};
cmp-fish.enable = true;
gitsigns.enable = true;
lualine = {
enable = true;
settings.options.theme = lib.mkForce "gruvbox";
};
luasnip = {
enable = true;
settings.update_events = "TextChanged,TextChangedI";
};
noice = {
enable = true;
settings = {
lsp.override = {
"vim.lsp.util.convert_input_to_markdown_lines" = true;
"vim.lsp.util.stylize_markdown" = true;
"cmp.entry.get_documentation" = true;
};
presets = {
# use a classic bottom cmdline for search
bottom_search = true;
# position the cmdline and popupmenu together
command_palette = false;
# long messages will be sent to a split
long_message_to_split = true;
# enables an input dialog for inc-rename.nvim
inc_rename = false;
# add a border to hover docs and signature help
lsp_doc_border = true;
};
};
};
notify = {
enable = true;
settings.background_colour = "#000000";
};
telescope = {
enable = true;
extensions = {
ui-select.enable = true;
fzy-native.enable = true;
};
};
trouble = {
enable = true;
settings.auto_close = true;
};
web-devicons.enable = true;
};
}

View file

@ -6,9 +6,10 @@ in
imports = [ ./options.nix ];
config.programs.nixvim = lib.mkMerge [
./standalone.nix
(import ./standalone.nix)
(lib.mkIf cfg.enable {
enable = true;
nixpkgs.useGlobalPackages = true;
defaultEditor = lib.mkDefault true;
jhome.nvim = cfg;
})

View file

@ -7,7 +7,6 @@
}:
let
inherit (helpers) enableExceptInTests;
inherit (lib.trivial) const;
cfg = config.jhome.nvim;
enabledLSPs = [
"basedpyright"
@ -22,20 +21,22 @@ let
"typos_lsp"
# "typst_lsp" # Not using it
"zls"
"fish_lsp"
];
enableOpt.enable = true;
noPackage.package = null;
in
{
config = lib.mkIf cfg.dev.enable (
lib.mkMerge [
# Enable LSPs
{ plugins.lsp.servers = lib.genAttrs enabledLSPs (const enableOpt); }
{
plugins.lsp.servers = lib.genAttrs enabledLSPs (_: {
enable = true;
});
}
# Remove bundled LSPs
(lib.mkIf (!cfg.dev.bundleLSPs) {
plugins.lsp.servers = lib.genAttrs enabledLSPs (const noPackage);
plugins.lsp.servers = lib.genAttrs enabledLSPs (_: {
package = null;
});
})
# Configure LSPs
{
@ -50,12 +51,11 @@ in
return vim.fs.root(0, {'flake.nix', '.git', '.jj', 'pyproject.toml', 'setup.py'})
end
'';
# Big but infrequently used dependencies.
#
# Configure the LSPs, but don't install the packages.
# If you need to use them, add them to your project's devShell
clangd = noPackage;
zls = noPackage;
bashls.package = lib.mkDefault pkgs.bash-language-server;
# Adds ~2 GiB, install in a devShell instead
clangd.package = lib.mkDefault null;
# zls & other zig tools are big, install in a devShell instead
zls.package = lib.mkDefault null;
};
};
lspkind = {
@ -81,10 +81,10 @@ in
(lib.mkIf (!cfg.dev.bundleGrammars) { plugins.treesitter.grammarPackages = [ ]; })
# Remove tools for building gramars when bundling them
(lib.mkIf cfg.dev.bundleGrammars {
dependencies = {
gcc.enable = false;
nodejs.enable = false;
tree-sitter.enable = false;
plugins.treesitter = {
gccPackage = null;
nodejsPackage = null;
treesitterPackage = null;
};
})
# Configure Formatters
@ -95,7 +95,6 @@ in
pkgs.stylua
pkgs.taplo
pkgs.yamlfmt
pkgs.fish
];
plugins.conform-nvim = {
enable = true;
@ -112,7 +111,6 @@ in
toml = [ "taplo" ];
yaml = [ "yamlfmt" ];
zig = [ "zigfmt" ];
fish = [ "fish_indent" ];
};
};
};
@ -129,6 +127,7 @@ in
# latex = [ "chktex" ]; # Not in use
nix = [ "statix" ];
sh = [ "dash" ];
zsh = [ "zsh" ];
};
};
}
@ -158,9 +157,17 @@ in
}
# Rust plugins
{
plugins.rustaceanvim.enable = true;
# install through rustup
dependencies.rust-analyzer.enable = false;
plugins = {
bacon = {
enable = true;
settings.quickfix.enabled = true;
};
rustaceanvim = {
enable = true;
# Install through rustup
rustAnalyzerPackage = null;
};
};
}
# Other plugins
{

View file

@ -0,0 +1,11 @@
{ pkgs }:
let
overlay = pkgs.callPackage ./generated.nix {
inherit (pkgs.vimUtils) buildVimPlugin buildNeovimPlugin;
};
plugins = overlay pkgs pkgs;
in
{
inherit overlay;
inherit (plugins) nvim-silicon;
}

View file

@ -10,12 +10,12 @@
final: prev: {
nvim-silicon = buildVimPlugin {
pname = "nvim-silicon";
version = "2025-01-09";
version = "2024-08-31";
src = fetchFromGitHub {
owner = "michaelrommel";
repo = "nvim-silicon";
rev = "7f66bda8f60c97a5bf4b37e5b8acb0e829ae3c32";
sha256 = "1zk6lgghvdcys20cqvh2g1kjf661q1w97niq5nx1zz4yppy2f9jy";
rev = "9fe6001dc8cad4d9c53bcfc8649e3dc76ffa169c";
sha256 = "1qczi06yndkr2pmwidlkgmk0395x189sznvscn4fnr96jx58j5yl";
};
meta.homepage = "https://github.com/michaelrommel/nvim-silicon/";
};

178
nvim/plugins.nix Normal file
View file

@ -0,0 +1,178 @@
{ lib, helpers, ... }:
let
inherit (helpers) mkRaw;
in
{
config.plugins = {
cmp = {
enable = true;
cmdline = {
"/" = {
mapping =
mkRaw
# lua
''
cmp.mapping.preset.cmdline()
'';
sources = [
{ name = "rg"; }
{ name = "buffer"; }
];
};
":" = {
mapping =
mkRaw
# lua
''
cmp.mapping.preset.cmdline()
'';
sources = [
{ name = "path"; }
{ name = "cmdline"; }
];
};
};
settings = {
# Snippets
snippet.expand =
# lua
''
function(args) require('luasnip').lsp_expand(args.body) end
'';
# Completion Sources
sources = [
{
name = "buffer";
groupIndex = 3;
}
{
name = "calc";
groupIndex = 2;
}
{
name = "conventionalcommits";
groupIndex = 1;
}
{
name = "crates";
groupIndex = 1;
}
{
name = "luasnip";
groupIndex = 1;
}
{
name = "nvim_lsp";
groupIndex = 1;
}
{
name = "nvim_lsp_document_symbol";
groupIndex = 1;
}
{
name = "nvim_lsp_signature_help";
groupIndex = 1;
}
{
name = "path";
groupIndex = 2;
}
{
name = "spell";
groupIndex = 2;
}
{
name = "treesitter";
groupIndex = 2;
}
];
mapping =
mkRaw
# lua
''
cmp.mapping.preset.insert({
["<C-n>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end,
["<C-p>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end,
["<C-u>"] = cmp.mapping(function(fallback)
if require("luasnip").choice_active() then
require("luasnip").next_choice()
else
fallback()
end
end),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete { },
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm { select = true },
})
'';
};
};
gitsigns.enable = true;
lualine = {
enable = true;
settings.options.theme = lib.mkForce "gruvbox";
};
luasnip = {
enable = true;
settings.update_events = "TextChanged,TextChangedI";
};
noice = {
enable = true;
settings = {
lsp.override = {
"vim.lsp.util.convert_input_to_markdown_lines" = true;
"vim.lsp.util.stylize_markdown" = true;
"cmp.entry.get_documentation" = true;
};
presets = {
# use a classic bottom cmdline for search
bottom_search = true;
# position the cmdline and popupmenu together
command_palette = false;
# long messages will be sent to a split
long_message_to_split = true;
# enables an input dialog for inc-rename.nvim
inc_rename = false;
# add a border to hover docs and signature help
lsp_doc_border = true;
};
};
};
notify = {
enable = true;
settings.background_colour = "#000000";
};
telescope = {
enable = true;
extensions = {
ui-select.enable = true;
fzy-native.enable = true;
};
};
trouble = {
enable = true;
settings.auto_close = true;
};
web-devicons.enable = true;
};
}

View file

@ -7,12 +7,7 @@
let
cfg = config.jhome.nvim;
plugins = pkgs.vimPlugins;
jExtraVimPlugins = pkgs.vimPlugins.extend (
pkgs.callPackage ./extraPlugins/generated.nix {
inherit (pkgs.vimUtils) buildVimPlugin;
inherit (pkgs.neovimUtils) buildNeovimPlugin;
}
);
extraPlugins = import ./extraPlugins { inherit pkgs; };
in
{
imports = [
@ -60,6 +55,7 @@ in
extraPlugins = [
plugins.nui-nvim
plugins.nvim-web-devicons
plugins.vim-jjdescription # FIXME: included since neovim nightly
];
extraPackages = [ pkgs.luajitPackages.jsregexp ];
extraConfigLuaPre =
@ -83,7 +79,7 @@ in
}
# Big packages that are kinda unnecessary
(lib.mkIf (!cfg.reduceSize) {
extraPlugins = [ jExtraVimPlugins.nvim-silicon ];
extraPlugins = [ extraPlugins.nvim-silicon ];
extraPackages = [ pkgs.silicon ];
extraConfigLua =
# lua

View file

@ -116,9 +116,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "4.5.37"
version = "4.5.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071"
checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83"
dependencies = [
"clap_builder",
"clap_derive",
@ -126,9 +126,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.37"
version = "4.5.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2"
checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8"
dependencies = [
"anstream",
"anstyle",
@ -174,9 +174,9 @@ dependencies = [
[[package]]
name = "errno"
version = "0.3.11"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e"
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
dependencies = [
"libc",
"windows-sys",
@ -214,15 +214,15 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "libc"
version = "0.2.172"
version = "0.2.170"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
[[package]]
name = "linux-raw-sys"
version = "0.9.4"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
checksum = "6db9c683daf087dc577b7506e9695b3d556a9f3849903fa28186283afd6809e9"
[[package]]
name = "memchr"
@ -263,9 +263,9 @@ dependencies = [
[[package]]
name = "miniz_oxide"
version = "0.8.8"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a"
checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5"
dependencies = [
"adler2",
]
@ -281,9 +281,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.21.3"
version = "1.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
checksum = "cde51589ab56b20a6f686b2c68f7a0bd6add753d697abf720d63f8db3ab7b1ad"
[[package]]
name = "os_pipe"
@ -303,18 +303,18 @@ checksum = "1036865bb9422d3300cf723f657c2851d0e9ab12567854b1f4eba3d77decf564"
[[package]]
name = "proc-macro2"
version = "1.0.95"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
checksum = "c1f1914ce909e1658d9907913b4b91947430c7d9be598b15a1912935b8c04801"
dependencies = [
"proc-macro2",
]
@ -327,9 +327,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustix"
version = "1.0.5"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf"
checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825"
dependencies = [
"bitflags",
"errno",

View file

@ -1,37 +1,23 @@
{ lib, ... }:
let
src = ./.;
# Autodetects files with a package.nix and calls `callPackage` on them.
#
# Will add a package .#dirname to the flake if it finds a ./dirname/package.nix file.
files = builtins.readDir src;
let
files = builtins.readDir ./.;
isPackage = path: type: (type == "directory") && (builtins.readDir path) ? "package.nix";
toPackage = name: pkgs: {
inherit name;
value = pkgs.callPackage "${src}/${name}/package.nix" { };
value = pkgs.callPackage (./. + "/${name}/package.nix") { };
};
# call pkgs.callPackage on all ./*/package.nix
makePackage =
pkgs: name:
let
type = files.${name};
path = "${src}/${name}";
path = ./. + "/${name}";
package = toPackage name pkgs;
in
# if it is a package then return a package otherwise return no package c:
if isPackage path type then [ package ] else [ ];
# we have lib.filterMapAttrs at home
scripts =
pkgs: builtins.listToAttrs (builtins.concatMap (makePackage pkgs) (builtins.attrNames files));
in
{
# Add scripts to overlay
flake.overlays.scripts = final: scripts;
# Add scripts to packages
perSystem =
{ pkgs, ... }:
{
packages = scripts pkgs;
};
}
# we have lib.filterMapAttrs at home
pkgs: builtins.listToAttrs (builtins.concatMap (makePackage pkgs) (builtins.attrNames files))

View file

@ -108,9 +108,9 @@ checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]]
name = "bstr"
version = "1.12.0"
version = "1.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4"
checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0"
dependencies = [
"memchr",
"serde",
@ -124,9 +124,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "4.5.37"
version = "4.5.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071"
checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83"
dependencies = [
"clap_builder",
"clap_derive",
@ -134,9 +134,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.37"
version = "4.5.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2"
checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8"
dependencies = [
"anstream",
"anstyle",
@ -217,9 +217,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.11.8"
version = "0.11.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
checksum = "c3716d7a920fb4fac5d84e9d4bce8ceb321e9414b4409da61b07b75c1e3d0697"
dependencies = [
"anstream",
"anstyle",
@ -230,9 +230,9 @@ dependencies = [
[[package]]
name = "errno"
version = "0.3.11"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e"
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
dependencies = [
"libc",
"windows-sys",
@ -293,9 +293,9 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "jiff"
version = "0.2.10"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a064218214dc6a10fbae5ec5fa888d80c45d611aba169222fc272072bf7aef6"
checksum = "d699bc6dfc879fb1bf9bdff0d4c56f0884fc6f0d0eb0fba397a6d00cd9a6b85e"
dependencies = [
"jiff-static",
"log",
@ -306,9 +306,9 @@ dependencies = [
[[package]]
name = "jiff-static"
version = "0.2.10"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "199b7932d97e325aff3a7030e141eafe7f2c6268e1d1b24859b753a627f45254"
checksum = "8d16e75759ee0aa64c57a56acbf43916987b20c77373cb7e808979e02b93c9f9"
dependencies = [
"proc-macro2",
"quote",
@ -329,21 +329,21 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.172"
version = "0.2.170"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
[[package]]
name = "linux-raw-sys"
version = "0.9.4"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
checksum = "6db9c683daf087dc577b7506e9695b3d556a9f3849903fa28186283afd6809e9"
[[package]]
name = "log"
version = "0.4.27"
version = "0.4.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
[[package]]
name = "memchr"
@ -384,9 +384,9 @@ dependencies = [
[[package]]
name = "miniz_oxide"
version = "0.8.8"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a"
checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5"
dependencies = [
"adler2",
]
@ -402,9 +402,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.21.3"
version = "1.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
checksum = "cde51589ab56b20a6f686b2c68f7a0bd6add753d697abf720d63f8db3ab7b1ad"
[[package]]
name = "os_pipe"
@ -439,18 +439,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.95"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
checksum = "c1f1914ce909e1658d9907913b4b91947430c7d9be598b15a1912935b8c04801"
dependencies = [
"proc-macro2",
]
@ -492,9 +492,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustix"
version = "1.0.5"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf"
checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825"
dependencies = [
"bitflags",
"errno",

129
system/default.nix Normal file
View file

@ -0,0 +1,129 @@
{ stylix }:
{
config,
pkgs,
lib,
...
}:
let
cfg = config.jconfig;
keysFromGithub = lib.attrsets.mapAttrs' (username: sha256: {
name = "pubkeys/${username}";
value = {
mode = "0755";
source = builtins.fetchurl {
inherit sha256;
url = "https://github.com/${username}.keys";
};
};
}) cfg.importSSHKeysFromGithub;
in
{
imports = [
./options.nix
./gui
stylix.nixosModules.stylix
{ stylix = import ./stylix-config.nix { inherit config pkgs; }; }
];
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
boot.plymouth = {
inherit (cfg.styling) enable;
};
# Enable unlocking the gpg-agent at boot (configured through home.nix)
security.pam.services.login.gnupg.enable = true;
environment.systemPackages = [
# CLI tools
pkgs.fd
pkgs.ripgrep
pkgs.du-dust
pkgs.curl
pkgs.zip
pkgs.unzip
];
# Enable dev documentation
documentation.dev = {
inherit (cfg.dev) enable;
};
programs = {
# Shell prompt
starship = {
enable = true;
settings = lib.mkMerge [
{
format = "$time$all";
add_newline = false;
cmd_duration.min_time = 500;
cmd_duration.show_milliseconds = true;
time.disabled = false;
status = {
format = "[$signal_name$common_meaning$maybe_int](red)";
symbol = "[](bold red)";
disabled = false;
};
sudo.disabled = false;
}
# Add nerdfont symbols
(lib.mkIf cfg.styling.enable (import ./starship-nerdfont-symbols.nix))
# Remove the `in`s and `on`s from the prompt
(lib.mkIf cfg.styling.enable (import ./starship-shorter-text.nix))
];
};
# Default shell
zsh.enable = true;
};
environment.etc = keysFromGithub;
services = {
# Enable printer autodiscovery if printing is enabled
avahi = {
inherit (config.services.printing) enable;
nssmdns4 = true;
openFirewall = true;
};
openssh.authorizedKeysFiles = builtins.map (path: "/etc/${path}") (
builtins.attrNames keysFromGithub
);
};
users.defaultUserShell = pkgs.zsh;
# Open ports for spotifyd
networking.firewall = {
allowedUDPPorts = [ 5353 ];
allowedTCPPorts = [ 2020 ];
};
# Nix Settings
nix = {
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
# run between 0 and 45min after boot if run was missed
randomizedDelaySec = "45min";
};
settings = {
use-xdg-base-directories = true;
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
};
};
}
# dev configuration
(lib.mkIf cfg.dev.enable {
users.extraUsers = lib.mkIf cfg.dev.jupyter.enable { jupyter.group = "jupyter"; };
services.jupyter = {
inherit (cfg.dev.jupyter) enable;
group = "jupyter";
user = "jupyter";
};
})
]
);
}

113
system/gui/default.nix Normal file
View file

@ -0,0 +1,113 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.jconfig.gui;
enable = config.jconfig.enable && cfg.enable;
linuxOlderThan6_3 = lib.versionOlder config.boot.kernelPackages.kernel.version "6.3";
in
{
config = lib.mkMerge [
(lib.mkIf enable {
environment.systemPackages = [
pkgs.adwaita-icon-theme
pkgs.adwaita-qt
pkgs.nordzy-cursor-theme
pkgs.pinentry-qt
] ++ lib.optional cfg.ydotool.enable pkgs.ydotool;
systemd = {
user.services.ydotool = lib.mkIf cfg.ydotool.enable {
enable = cfg.ydotool.autoStart;
wantedBy = [ "default.target" ];
description = "Generic command-line automation tool";
documentation = [
"man:ydotool(1)"
"man:ydotoold(8)"
];
serviceConfig = {
Type = "simple";
Restart = "always";
ExecStart = "${pkgs.ydotool}/bin/ydotoold";
ExecReload = "${pkgs.util-linux}/bin/kill -HUP $MAINPID";
KillMode = "process";
TimeoutSec = 180;
};
};
# Fix xdg-portals issue issue: https://github.com/NixOS/nixpkgs/issues/189851
user.extraConfig = ''
DefaultEnvironment="PATH=/run/wrappers/bin:/etc/profiles/per-user/%u/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
'';
};
fonts.fontDir.enable = true;
programs = {
dconf.enable = true;
niri = {
enable = cfg.windowManager;
package = pkgs.niri; # use nixpkgs' package instead of the flake's
};
};
security = {
polkit.enable = true;
rtkit.enable = true; # Recommended for pipewire
};
services = {
flatpak.enable = true;
# Audio
pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
wireplumber.enable = true;
};
# Dbus
dbus.enable = true;
# Virtual Filesystem (for PCManFM)
gvfs.enable = true;
};
xdg.portal = {
# XDG portals
enable = true;
wlr.enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
config.preferred = {
# Default to the gtk portal
default = "gtk";
# Use wlr for screenshots and screen recording
"org.freedesktop.impl.portal.Screenshot" = "wlr";
};
# Consider using darkman like upstream
};
hardware = {
graphics.enable = true;
uinput.enable = true;
steam-hardware.enable = cfg.steamHardwareSupport;
};
})
(lib.mkIf (enable && linuxOlderThan6_3 && cfg."8bitdoFix") {
# Udev rules to start or stop systemd service when controller is connected or disconnected
services.udev.extraRules = # udev
''
# May vary depending on your controller model, find product id using 'lsusb'
SUBSYSTEM=="usb", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3106", ATTR{manufacturer}=="8BitDo", RUN+="${pkgs.systemd}/bin/systemctl start 8bitdo-ultimate-xinput@2dc8:3106"
# This device (2dc8:3016) is "connected" when the above device disconnects
SUBSYSTEM=="usb", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3016", ATTR{manufacturer}=="8BitDo", RUN+="${pkgs.systemd}/bin/systemctl stop 8bitdo-ultimate-xinput@2dc8:3106"
'';
# Systemd service which starts xboxdrv in xbox360 mode
systemd.services."8bitdo-ultimate-xinput@" = {
unitConfig.Description = "8BitDo Ultimate Controller XInput mode xboxdrv daemon";
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.xboxdrv}/bin/xboxdrv --mimic-xpad --silent --type xbox360 --device-by-id %I --force-feedback";
};
};
})
];
}

119
system/options.nix Normal file
View file

@ -0,0 +1,119 @@
{ lib, ... }:
let
inherit (lib) types;
# Like mkEnableOption but defaults to true
mkDisableOption =
option:
(lib.mkEnableOption option)
// {
default = true;
example = false;
};
mkImageOption =
{
description,
url,
sha256 ? "",
}:
lib.mkOption {
inherit description;
type = types.path;
default = builtins.fetchurl { inherit url sha256; };
defaultText = lib.literalMD "![${description}](${url})";
};
gui.options = {
enable = lib.mkEnableOption "jalil's default gui configuration.";
# Fix for using Xinput mode on 8bitdo Ultimate C controller
# Inspired by https://aur.archlinux.org/packages/8bitdo-ultimate-controller-udev
# Adapted from: https://gist.github.com/interdependence/28452fbfbe692986934fbe1e54c920d4
"8bitdoFix" = mkDisableOption "a fix for 8bitdo controllers";
steamHardwareSupport = mkDisableOption "steam hardware support";
ydotool = lib.mkOption {
description = "Jalil's default ydotool configuration.";
default = { };
type = types.submodule {
options.enable = mkDisableOption "ydotool";
options.autoStart = mkDisableOption "autostarting ydotool at login";
};
};
windowManager = lib.mkOption {
description = "Window manager configuration";
default = { };
type = types.submodule {
options = {
enable = mkDisableOption "window manager";
windowManager = lib.mkOption {
description = "Which window manager to enable";
type = types.enum [ "niri" ];
default = "niri";
};
};
};
};
};
styling.options = {
enable = mkDisableOption "jalil's default styling (disables stylix)";
wallpaper = mkImageOption {
description = "The wallpaper to use.";
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
};
bootLogo = mkImageOption {
description = "The logo used by plymouth at boot.";
# http://xenia-linux-site.glitch.me/images/cathodegaytube-splash.png
url = "https://efimero.github.io/xenia-images/cathodegaytube-splash.png";
sha256 = "qKugUfdRNvMwSNah+YmMepY3Nj6mWlKFh7jlGlAQDo8=";
};
};
config.options = {
enable = lib.mkEnableOption "jalil's default configuration.";
dev = lib.mkOption {
description = "Options for setting up a dev environment";
default = { };
type = types.submodule {
options.enable = lib.mkEnableOption "dev configuration";
options.jupyter.enable = lib.mkEnableOption "jupyter configuration";
};
};
gui = lib.mkOption {
description = "Jalil's default configuration for a NixOS gui.";
default = { };
type = types.submodule gui;
};
styling = lib.mkOption {
description = "Jalil's styling options";
default = { };
type = types.submodule styling;
};
importSSHKeysFromGithub = lib.mkOption {
description = ''
Import public ssh keys from a github username.
This will fetch the keys from https://github.com/$${username}.keys.
The format is `"$${github-username}" = $${sha256-hash}`. The example
will try to fetch the keys from <https://github.com/jalil-salame.keys>.
**Warning**: this will interfere with services like gitea that override
the default ssh behaviour. In that case you want to use
`users.users.<name>.openssh.authorizedKeys.keyFiles` on the users you
want to allow ssh logins.
'';
default = { };
example = {
"jalil-salame" = "sha256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
};
type = types.attrsOf types.str;
};
};
in
{
options.jconfig = lib.mkOption {
description = "Jalil's default NixOS configuration.";
default = { };
type = types.submodule config;
};
}

View file

@ -0,0 +1,89 @@
{
aws.symbol = " ";
buf.symbol = " ";
c.symbol = " ";
conda.symbol = " ";
crystal.symbol = " ";
dart.symbol = " ";
directory.read_only = " 󰌾";
docker_context.symbol = " ";
elixir.symbol = " ";
elm.symbol = " ";
fennel.symbol = " ";
fossil_branch.symbol = " ";
git_branch.symbol = " ";
git_commit.tag_symbol = " ";
golang.symbol = " ";
gradle.symbol = " ";
guix_shell.symbol = " ";
haskell.symbol = " ";
haxe.symbol = " ";
hg_branch.symbol = " ";
hostname.ssh_symbol = " ";
java.symbol = " ";
julia.symbol = " ";
kotlin.symbol = " ";
lua.symbol = " ";
memory_usage.symbol = "󰍛 ";
meson.symbol = "󰔷 ";
nim.symbol = "󰆥 ";
nix_shell.symbol = " ";
nodejs.symbol = " ";
ocaml.symbol = " ";
package.symbol = "󰏗 ";
perl.symbol = " ";
php.symbol = " ";
pijul_channel.symbol = " ";
python.symbol = " ";
rlang.symbol = "󰟔 ";
ruby.symbol = " ";
rust.symbol = "󱘗 ";
scala.symbol = " ";
swift.symbol = " ";
zig.symbol = " ";
os.symbols = {
Alpaquita = " ";
Alpine = " ";
AlmaLinux = " ";
Amazon = " ";
Android = " ";
Arch = " ";
Artix = " ";
CentOS = " ";
Debian = " ";
DragonFly = " ";
Emscripten = " ";
EndeavourOS = " ";
Fedora = " ";
FreeBSD = " ";
Garuda = "󰛓 ";
Gentoo = " ";
HardenedBSD = "󰞌 ";
Illumos = "󰈸 ";
Kali = " ";
Linux = " ";
Mabox = " ";
Macos = " ";
Manjaro = " ";
Mariner = " ";
MidnightBSD = " ";
Mint = " ";
NetBSD = " ";
NixOS = " ";
OpenBSD = "󰈺 ";
openSUSE = " ";
OracleLinux = "󰌷 ";
Pop = " ";
Raspbian = " ";
Redhat = " ";
RedHatEnterprise = " ";
RockyLinux = " ";
Redox = "󰀘 ";
Solus = "󰠳 ";
SUSE = " ";
Ubuntu = " ";
Unknown = " ";
Void = " ";
Windows = "󰍲 ";
};
}

View file

@ -0,0 +1,66 @@
{
aws.format = "[$symbol($profile)(\\($region\\))(\\[$duration\\])]($style) ";
bun.format = "[$symbol($version)]($style) ";
c.format = "[$symbol($version(-$name))]($style) ";
cmake.format = "[$symbol($version)]($style) ";
cmd_duration.format = "[ $duration]($style) ";
cobol.format = "[$symbol($version)]($style) ";
conda.format = "[$symbol$environment]($style) ";
crystal.format = "[$symbol($version)]($style) ";
daml.format = "[$symbol($version)]($style) ";
dart.format = "[$symbol($version)]($style) ";
deno.format = "[$symbol($version)]($style) ";
docker_context.format = "[$symbol$context]($style) ";
dotnet.format = "[$symbol($version)(🎯 $tfm)]($style) ";
elixir.format = "[$symbol($version \\(OTP $otp_version\\))]($style) ";
elm.format = "[$symbol($version)]($style) ";
erlang.format = "[$symbol($version)]($style) ";
fennel.format = "[$symbol($version)]($style) ";
fossil_branch.format = "[$symbol$branch]($style) ";
gcloud.format = "[$symbol$account(@$domain)(\\($region\\))]($style) ";
git_branch.format = "[$symbol$branch]($style) ";
git_status.format = "[$all_status$ahead_behind]($style) ";
golang.format = "[$symbol($version)]($style) ";
gradle.format = "[$symbol($version)]($style) ";
guix_shell.format = "[$symbol]($style) ";
haskell.format = "[$symbol($version)]($style) ";
haxe.format = "[$symbol($version)]($style) ";
helm.format = "[$symbol($version)]($style) ";
hg_branch.format = "[$symbol$branch]($style) ";
java.format = "[$symbol($version)]($style) ";
julia.format = "[$symbol($version)]($style) ";
kotlin.format = "[$symbol($version)]($style) ";
kubernetes.format = "[$symbol$context( \\($namespace\\))]($style) ";
lua.format = "[$symbol($version)]($style) ";
memory_usage.format = "$symbol[$ram( | $swap)]($style) ";
meson.format = "[$symbol$project]($style) ";
nim.format = "[$symbol($version)]($style) ";
nix_shell.format = "[$symbol$state( \\($name\\))]($style) ";
nodejs.format = "[$symbol($version)]($style) ";
ocaml.format = "[$symbol($version)(\\($switch_indicator$switch_name\\))]($style) ";
opa.format = "[$symbol($version)]($style) ";
openstack.format = "[$symbol$cloud(\\($project\\))]($style) ";
os.format = "[$symbol]($style) ";
package.format = "[$symbol$version]($style) ";
perl.format = "[$symbol($version)]($style) ";
php.format = "[$symbol($version)]($style) ";
pijul_channel.format = "[$symbol$channel]($style) ";
pulumi.format = "[$symbol$stack]($style) ";
purescript.format = "[$symbol($version)]($style) ";
python.format = "[\${symbol}\${pyenv_prefix}(\${version})(\\($virtualenv\\))]($style) ";
raku.format = "[$symbol($version-$vm_version)]($style) ";
red.format = "[$symbol($version)]($style) ";
ruby.format = "[$symbol($version)]($style) ";
rust.format = "[$symbol($version)]($style) ";
scala.format = "[$symbol($version)]($style) ";
spack.format = "[$symbol$environment]($style) ";
sudo.format = "[as $symbol]($style) ";
swift.format = "[$symbol($version)]($style) ";
terraform.format = "[$symbol$workspace]($style) ";
time.format = "[$time]($style) ";
username.format = "[$user]($style) ";
vagrant.format = "[$symbol($version)]($style) ";
vlang.format = "[$symbol($version)]($style) ";
zig.format = "[$symbol($version)]($style) ";
solidity.format = "[$symbol($version)]($style) ";
}

36
system/stylix-config.nix Normal file
View file

@ -0,0 +1,36 @@
{ config, pkgs }:
let
cfg = config.jconfig.styling;
in
{
inherit (cfg) enable;
image = cfg.wallpaper;
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
polarity = "dark";
fonts = {
monospace = {
name = "JetBrains Mono";
package = pkgs.jetbrains-mono;
};
sansSerif = {
name = "Noto Sans";
package = pkgs.noto-fonts;
};
serif = {
name = "Noto Serif";
package = pkgs.noto-fonts;
};
emoji = {
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
sizes.popups = 12;
};
targets = {
plymouth = {
logoAnimated = false;
logo = cfg.bootLogo;
};
nixvim.enable = false;
};
}