alejandra fmt and some cleanup

try-kitty
htran 2023-06-18 02:51:33 -07:00
parent e62e724c4d
commit 024e8530d0
13 changed files with 358 additions and 403 deletions

View File

@ -48,9 +48,9 @@
},
"crane": {
"inputs": {
"flake-compat": "flake-compat_4",
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_3",
"nixpkgs": "nixpkgs_2",
"rust-overlay": "rust-overlay"
},
"locked": {
@ -69,7 +69,7 @@
},
"crane_2": {
"inputs": {
"flake-compat": "flake-compat_6",
"flake-compat": "flake-compat_5",
"flake-utils": "flake-utils_7",
"nixpkgs": [
"nix-boost",
@ -95,7 +95,7 @@
},
"crane_3": {
"inputs": {
"flake-compat": "flake-compat_7",
"flake-compat": "flake-compat_6",
"flake-utils": "flake-utils_9",
"nixpkgs": [
"std",
@ -118,26 +118,6 @@
"type": "github"
}
},
"deploy-rs": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs",
"utils": "utils"
},
"locked": {
"lastModified": 1686747123,
"narHash": "sha256-XUQK9kwHpTeilHoad7L4LjMCCyY13Oq383CoFADecRE=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "724463b5a94daa810abfc64a4f87faef4e00f984",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "deploy-rs",
"type": "github"
}
},
"devshell": {
"inputs": {
"nixpkgs": [
@ -250,7 +230,7 @@
},
"fenix": {
"inputs": {
"nixpkgs": "nixpkgs_9",
"nixpkgs": "nixpkgs_8",
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
@ -269,7 +249,7 @@
},
"fenix_2": {
"inputs": {
"nixpkgs": "nixpkgs_13",
"nixpkgs": "nixpkgs_12",
"rust-analyzer-src": "rust-analyzer-src_2"
},
"locked": {
@ -289,11 +269,11 @@
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1668681692,
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
@ -382,22 +362,6 @@
"type": "github"
}
},
"flake-compat_7": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
@ -645,8 +609,8 @@
},
"gomod2nix": {
"inputs": {
"nixpkgs": "nixpkgs_4",
"utils": "utils_2"
"nixpkgs": "nixpkgs_3",
"utils": "utils"
},
"locked": {
"lastModified": 1677459247,
@ -680,7 +644,7 @@
},
"haumea": {
"inputs": {
"nixpkgs": "nixpkgs_7"
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1685133229,
@ -699,7 +663,7 @@
},
"haumea_2": {
"inputs": {
"nixpkgs": "nixpkgs_11"
"nixpkgs": "nixpkgs_10"
},
"locked": {
"lastModified": 1685133229,
@ -721,7 +685,7 @@
"flake-parts": "flake-parts_3",
"haskell-flake": "haskell-flake",
"nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs",
"pre-commit-hooks-nix": "pre-commit-hooks-nix"
},
"locked": {
@ -919,7 +883,7 @@
},
"neovim-nightly-overlay": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"hercules-ci-effects": "hercules-ci-effects",
"neovim-flake": "neovim-flake",
@ -946,10 +910,10 @@
"inputs": {
"cargo-leptos": "cargo-leptos",
"crane": "crane",
"flake-compat": "flake-compat_5",
"flake-compat": "flake-compat_4",
"gnmic": "gnmic",
"gomod2nix": "gomod2nix",
"nixpkgs": "nixpkgs_5",
"nixpkgs": "nixpkgs_4",
"poetry2nix": "poetry2nix",
"rust-overlay": "rust-overlay_2",
"std": "std"
@ -1075,27 +1039,27 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1671417167,
"narHash": "sha256-JkHam6WQOwZN1t2C2sbp1TqMv3TVRjzrdoejqfefwrM=",
"lastModified": 1678293141,
"narHash": "sha256-lLlQHaR0y+q6nd6kfpydPTGHhl1rS9nU9OQmztzKOYs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bb31220cca6d044baa6dc2715b07497a2a7c4bc7",
"rev": "c90c4025bb6e0c4eaf438128a3b2640314b1c58d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-latest": {
"locked": {
"lastModified": 1687069865,
"narHash": "sha256-+JcVIxijVccnSnbGl8INEKkRo3GzHZ7iBm4EZ2MC1O8=",
"lastModified": 1687079694,
"narHash": "sha256-x3YujFqPUWj9TvuFEZthr++xzzOmMYPaoSDSuzqUDnc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5630d719e9e90f66f9eaa4a2d00b303dbee9f4c3",
"rev": "30c0a2f73819cc71ff5ff270f6ae4aaafaf954ea",
"type": "github"
},
"original": {
@ -1139,22 +1103,6 @@
}
},
"nixpkgs_10": {
"locked": {
"lastModified": 1686960236,
"narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "04af42f3b31dba0ef742d254456dc4c14eedac86",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_11": {
"locked": {
"lastModified": 1681001314,
"narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=",
@ -1169,7 +1117,7 @@
"type": "github"
}
},
"nixpkgs_12": {
"nixpkgs_11": {
"locked": {
"lastModified": 1675940568,
"narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=",
@ -1185,7 +1133,7 @@
"type": "github"
}
},
"nixpkgs_13": {
"nixpkgs_12": {
"locked": {
"lastModified": 1677063315,
"narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=",
@ -1202,22 +1150,6 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1678293141,
"narHash": "sha256-lLlQHaR0y+q6nd6kfpydPTGHhl1rS9nU9OQmztzKOYs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c90c4025bb6e0c4eaf438128a3b2640314b1c58d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1685714850,
"narHash": "sha256-OcvbIJq4CGwwFr9m7M/SQcDPZ64hhR4t77oZgEeh7ZY=",
@ -1233,7 +1165,7 @@
"type": "github"
}
},
"nixpkgs_4": {
"nixpkgs_3": {
"locked": {
"lastModified": 1658285632,
"narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=",
@ -1249,7 +1181,7 @@
"type": "github"
}
},
"nixpkgs_5": {
"nixpkgs_4": {
"locked": {
"lastModified": 1686960236,
"narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
@ -1265,7 +1197,7 @@
"type": "github"
}
},
"nixpkgs_6": {
"nixpkgs_5": {
"locked": {
"lastModified": 1681358109,
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
@ -1281,7 +1213,7 @@
"type": "github"
}
},
"nixpkgs_7": {
"nixpkgs_6": {
"locked": {
"lastModified": 1681001314,
"narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=",
@ -1296,7 +1228,7 @@
"type": "github"
}
},
"nixpkgs_8": {
"nixpkgs_7": {
"locked": {
"lastModified": 1675940568,
"narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=",
@ -1312,7 +1244,7 @@
"type": "github"
}
},
"nixpkgs_9": {
"nixpkgs_8": {
"locked": {
"lastModified": 1677063315,
"narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=",
@ -1328,6 +1260,22 @@
"type": "github"
}
},
"nixpkgs_9": {
"locked": {
"lastModified": 1686960236,
"narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "04af42f3b31dba0ef742d254456dc4c14eedac86",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nosys": {
"locked": {
"lastModified": 1668010795,
@ -1591,7 +1539,7 @@
},
"pre-commit-hooks-nix": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils",
"gitignore": "gitignore",
"nixpkgs": [
@ -1618,13 +1566,12 @@
},
"root": {
"inputs": {
"deploy-rs": "deploy-rs",
"home-manager": "home-manager",
"kpcli-py": "kpcli-py",
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-boost": "nix-boost",
"nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs_10",
"nixpkgs": "nixpkgs_9",
"nixpkgs-latest": "nixpkgs-latest",
"std": "std_2"
}
@ -1693,7 +1640,7 @@
"rust-overlay_2": {
"inputs": {
"flake-utils": "flake-utils_5",
"nixpkgs": "nixpkgs_6"
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1687055571,
@ -1794,7 +1741,7 @@
],
"n2c": "n2c",
"nixago": "nixago",
"nixpkgs": "nixpkgs_8",
"nixpkgs": "nixpkgs_7",
"paisano": "paisano",
"paisano-mdbook-preprocessor": "paisano-mdbook-preprocessor",
"paisano-tui": "paisano-tui",
@ -1836,7 +1783,7 @@
],
"n2c": "n2c_2",
"nixago": "nixago_2",
"nixpkgs": "nixpkgs_12",
"nixpkgs": "nixpkgs_11",
"paisano": "paisano_2",
"paisano-mdbook-preprocessor": "paisano-mdbook-preprocessor_2",
"paisano-tui": "paisano-tui_2",
@ -1932,21 +1879,6 @@
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"utils_2": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",

View File

@ -8,7 +8,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-latest.url = "github:nixos/nixpkgs";
deploy-rs.url = "github:serokell/deploy-rs";
# deploy-rs.url = "github:serokell/deploy-rs";
std.url = "github:divnix/std";
home-manager = {
url = "github:nix-community/home-manager";
@ -33,7 +33,11 @@
};
};
outputs = {self, std, ...} @ inputs:
outputs = {
self,
std,
...
} @ inputs:
std.growOn
{
# boilerplate
@ -50,7 +54,7 @@
(devshells "userShells")
(functions "home-profiles")
(functions "home-modules")
(anything "home-configs")
(anything "home-configs")
(installables "packages")
(anything "lib")
];

View File

@ -1,4 +1,5 @@
# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project TODO: just install these things, then symlink to mason's bin directory
# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project
# TODO: just install these things, then symlink to mason's bin directory
#
# One thing to consider, though, /nix/store of `nix-shell` or `nix-develop`
# might be different from `home-manager`'s (~/.nix_profile/bin/jq)
@ -15,14 +16,6 @@
# see: :/--suffix.*PATH
# there should be mentions of additional packages
my_neovim = pkgs.neovim-unwrapped;
rust_pkgs =
pkgs.rust-bin.selectLatestNightlyWith
(
toolchain:
toolchain.default.override {
extensions = ["rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri"];
}
);
nvim_pkgs =
[
# pkgs.gccStdenv

View File

@ -20,5 +20,4 @@ in {
});
});
};
}

View File

@ -8,18 +8,23 @@
pkgs = inputs.nixpkgs;
# hm is derivation that is compatible with homeConfigurations
home-config = {supported_systems, hm, tested_systems ? []}:
hm // {
_supported_systems = supported_systems;
_tested_systems = tested_systems;
};
home-config = {
supported_systems,
hm,
tested_systems ? [],
}:
hm
// {
_supported_systems = supported_systems;
_tested_systems = tested_systems;
};
base-modules = [
home-profiles.alacritty
# home-profiles.git
home-profiles.ssh
home-profiles.shells
({config.programs.home-manager.enable = true;})
{config.programs.home-manager.enable = true;}
home-profiles.nix-index
home-profiles.neovim
];
@ -29,19 +34,21 @@ in {
tested_systems = ["aarch64-darwin"];
hm = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = base-modules ++ [
home-profiles.nerd_font_module
home-profiles.git-htran
home-profiles.dev-packages
home-profiles.zk
home-modules.darwin-spotlight
modules =
base-modules
++ [
home-profiles.nerd_font_module
home-profiles.git-htran
home-profiles.dev-packages
home-profiles.zk
home-modules.darwin-spotlight
({
home.username = "htran";
home.homeDirectory = "/Users/htran";
home.stateVersion = "23.11";
})
];
{
home.username = "htran";
home.homeDirectory = "/Users/htran";
home.stateVersion = "23.11";
}
];
};
};
}

View File

@ -1,201 +1,218 @@
# This is an interface for home-profiles and should not contain opinionated
# configurations. It should provide alternative configurations, aggregates
# or new configurations
_imports@{ inputs, cell }:
let
_imports @ {
inputs,
cell,
}: let
namespace = "repo";
imports = _imports // { inherit namespace; };
in
{
git = { config, lib, ... }:
let
cfg = config."${namespace}".git;
baseAliases = {
a = "add";
c = "commit";
ca = "commit --amend";
cm = "commit -m";
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
sts = "status";
co = "checkout";
b = "branch";
imports = _imports // {inherit namespace;};
in {
git = {
config,
lib,
...
}: let
cfg = config."${namespace}".git;
baseAliases = {
a = "add";
c = "commit";
ca = "commit --amend";
cm = "commit -m";
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
sts = "status";
co = "checkout";
b = "branch";
};
default-user = "Pegasust";
default-email = "pegasucksgg@gmail.com";
in {
options."${namespace}".git = {
aliases = lib.mkOption {
type = lib.types.attrs;
default = {};
example = baseAliases;
description = ''
Additional git aliases. This settings comes with base configuration.
Redeclaring the base config will override the values.
''; # TODO: Add baseAliases as string here (builtins.toString doesn't work)
};
default-user = "Pegasust";
default-email = "pegasucksgg@gmail.com";
in
{
options."${namespace}".git = {
aliases = lib.mkOption {
type = lib.types.attrs;
default = { };
example = baseAliases;
description = ''
Additional git aliases. This settings comes with base configuration.
Redeclaring the base config will override the values.
''; # TODO: Add baseAliases as string here (builtins.toString doesn't work)
};
name = lib.mkOption {
type = lib.types.str;
default = default-user;
description = "Git username that appears on commits";
example = default-user;
};
email = lib.mkOption {
type = lib.types.str;
default = default-email;
example = default-email;
description = "Git email that appears on commits";
};
ignores = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
".vscode" # vscode settings
".direnv" # .envrc cached outputs
".DS_Store" # MacOS users, amrite
];
description = ''
.gitignore patterns that are applied in every "${namespace}"sitory.
This is useful for IDE-specific settings.
'';
example = [ ".direnv" "node_modules" ];
};
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enables git
'';
example = false;
};
credentialCacheTimeoutSeconds = lib.mkOption {
type = lib.types.int;
default = 3000;
description = "Credential cache (in-memory store) for Git in seconds.";
example = 3000;
};
name = lib.mkOption {
type = lib.types.str;
default = default-user;
description = "Git username that appears on commits";
example = default-user;
};
# TODO : anyway to override configuration?
# idk wtf I was thinking about. there is no context in this question
config.programs.git = {
inherit (cfg) enable ignores;
userName = cfg.name;
userEmail = cfg.email;
aliases = baseAliases // cfg.aliases;
extraConfig = {
# TODO: in the case of darwin, git always open up the built-in keychain.
# possibly something we can't really control since we don't have access to `nix-darwin`
credential.helper = "cache --timeout=${builtins.toString cfg.credentialCacheTimeoutSeconds}";
};
lfs.enable = true;
email = lib.mkOption {
type = lib.types.str;
default = default-email;
example = default-email;
description = "Git email that appears on commits";
};
ignores = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
".vscode" # vscode settings
".direnv" # .envrc cached outputs
".DS_Store" # MacOS users, amrite
];
description = ''
.gitignore patterns that are applied in every "${namespace}"sitory.
This is useful for IDE-specific settings.
'';
example = [".direnv" "node_modules"];
};
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enables git
'';
example = false;
};
credentialCacheTimeoutSeconds = lib.mkOption {
type = lib.types.int;
default = 3000;
description = "Credential cache (in-memory store) for Git in seconds.";
example = 3000;
};
};
# TODO : anyway to override configuration?
# idk wtf I was thinking about. there is no context in this question
config.programs.git = {
inherit (cfg) enable ignores;
userName = cfg.name;
userEmail = cfg.email;
aliases = baseAliases // cfg.aliases;
extraConfig = {
# TODO: in the case of darwin, git always open up the built-in keychain.
# possibly something we can't really control since we don't have access to `nix-darwin`
credential.helper = "cache --timeout=${builtins.toString cfg.credentialCacheTimeoutSeconds}";
};
lfs.enable = true;
};
};
alacritty = { config, lib, ... }:
let
inherit (inputs.cells.repo.lib) fromYAML;
cfg = config."${namespace}".alacritty;
in
{
options."${namespace}".alacritty = {
font.family = lib.mkOption {
type = lib.types.nullOr lib.types.singleLineStr;
default = null;
description = ''
The font family for Alacritty
'';
example = "DroidSansMono NF";
};
font.size = lib.mkOption {
type = lib.types.nullOr lib.types.number;
default = 11.0;
description = ''
The default font size for Alacritty. This is probably measured in px.
'';
example = 7.0;
};
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enables alacritty
'';
example = true;
};
config-path = lib.mkOption {
type = lib.types.path;
description = "Path to alacritty yaml";
default = null;
example = "./config/alacritty.yaml";
};
alacritty = {
config,
lib,
...
}: let
inherit (inputs.cells.repo.lib) fromYAML;
cfg = config."${namespace}".alacritty;
in {
options."${namespace}".alacritty = {
font.family = lib.mkOption {
type = lib.types.nullOr lib.types.singleLineStr;
default = null;
description = ''
The font family for Alacritty
'';
example = "DroidSansMono NF";
};
config.programs.alacritty = {
enable = cfg.enable;
settings =
let
actualConfig =
if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else { };
in
lib.recursiveUpdate actualConfig {
font.normal.family = lib.mkIf (cfg.font.family != null) cfg.font.family;
font.size = lib.mkIf (cfg.font.size != null) cfg.font.size;
};
font.size = lib.mkOption {
type = lib.types.nullOr lib.types.number;
default = 11.0;
description = ''
The default font size for Alacritty. This is probably measured in px.
'';
example = 7.0;
};
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enables alacritty
'';
example = true;
};
config-path = lib.mkOption {
type = lib.types.path;
description = "Path to alacritty yaml";
default = null;
example = "./config/alacritty.yaml";
};
};
config.programs.alacritty = {
enable = cfg.enable;
settings = let
actualConfig =
if cfg.config-path != null
then fromYAML (builtins.readFile cfg.config-path)
else {};
in
lib.recursiveUpdate actualConfig {
font.normal.family = lib.mkIf (cfg.font.family != null) cfg.font.family;
font.size = lib.mkIf (cfg.font.size != null) cfg.font.size;
};
};
};
# TODO: chromium is not really supported on darwin
private_chromium = { config, pkgs, lib, ... }:
let
cfg = config."${namespace}".private_chromium;
in
{
options."${namespace}".private_chromium = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
Enable extremely lightweight chromium with vimium plugin
'';
};
};
config = lib.mkIf (cfg.enable) {
# home.packages = [pkgs.ungoogled-chromium];
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
extensions =
let
# TODO: how about a chrome extension registry?
mkChromiumExtForVersion = browserVersion: { id, sha256, extVersion, ... }:
{
inherit id;
crxPath = builtins.fetchurl {
url = "https://clients2.google.com/service/update2/crx" +
"?response=redirect" +
"&acceptformat=crx2,crx3" +
"&prodversion=${browserVersion}" +
"&x=id%3D${id}%26installsource%3Dondemand%26uc";
name = "${id}.crx";
inherit sha256;
};
version = extVersion;
};
mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version);
in
[
# vimium
(mkChromiumExt {
id = "dbepggeogbaibhgnhhndojpepiihcmeb";
sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic";
extVersion = "1.67.4";
})
];
};
private_chromium = {
config,
pkgs,
lib,
...
}: let
cfg = config."${namespace}".private_chromium;
in {
options."${namespace}".private_chromium = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
Enable extremely lightweight chromium with vimium plugin
'';
};
};
config = lib.mkIf (cfg.enable) {
# home.packages = [pkgs.ungoogled-chromium];
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
extensions = let
# TODO: how about a chrome extension registry?
mkChromiumExtForVersion = browserVersion: {
id,
sha256,
extVersion,
...
}: {
inherit id;
crxPath = builtins.fetchurl {
url =
"https://clients2.google.com/service/update2/crx"
+ "?response=redirect"
+ "&acceptformat=crx2,crx3"
+ "&prodversion=${browserVersion}"
+ "&x=id%3D${id}%26installsource%3Dondemand%26uc";
name = "${id}.crx";
inherit sha256;
};
version = extVersion;
};
mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version);
in [
# vimium
(mkChromiumExt {
id = "dbepggeogbaibhgnhhndojpepiihcmeb";
sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic";
extVersion = "1.67.4";
})
];
};
};
};
darwin-spotlight = { lib, pkgs, config, ... }: {
darwin-spotlight = {
lib,
pkgs,
config,
...
}: {
# This patch exists since Darwin's search bar requires solid apps and not
# symlinked
# TODO: QA
@ -207,15 +224,15 @@ in
# Copy GUI apps to "~/Applications/Home Manager Apps"
# Based on this comment: https://github.com/nix-community/home-manager/issues/1341#issuecomment-778820334
home.activation.patch-spotlight =
if pkgs.stdenv.isDarwin then
let
apps = pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
in
lib.hm.dag.entryAfter [ "linkGeneration" ] ''
if pkgs.stdenv.isDarwin
then let
apps = pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
in
lib.hm.dag.entryAfter ["linkGeneration"] ''
# Install MacOS applications to the user environment.
HM_APPS="$HOME/Applications/Home Manager Apps"
# Reset current state
@ -229,22 +246,19 @@ in
$DRY_RUN_CMD cp --archive -H --dereference ${apps}/Applications/* "$HM_APPS"
$DRY_RUN_CMD chmod +w -R "$HM_APPS"
''
else
"";
else "";
# We need this in case upstream home-manager changes the behavior of linking
# applications
home.activation.remove-patch-spotlight =
if pkgs.stdenv.isDarwin then
lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
if pkgs.stdenv.isDarwin
then
lib.hm.dag.entryBefore ["checkLinkTargets"] ''
HM_APPS="$HOME/Applications/Home Manager Apps"
# Reset current state
if [ -e "$HM_APPS" ]; then
$DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)"
fi
''
else
"";
else "";
};
}

View File

@ -163,7 +163,9 @@ in {
};
};
dev-packages = let pkgs = inputs.nixpkgs; in {
dev-packages = let
pkgs = inputs.nixpkgs;
in {
programs.jq.enable = true;
home.packages = [
pkgs.htop

View File

@ -28,7 +28,7 @@
pkgs.zk # Zettelkasten (limited support)
pkgs.fd # Required by a Telescope plugin (?)
pkgs.stdenv.cc.cc.lib
pkgs.nil # oxalica's better nix language server
pkgs.nil # oxalica's better nix language server
inputs.nix-boost.packages."${system}".rust4cargo
pkgs.nickel
pkgs.nls

View File

@ -1,16 +1,20 @@
{ inputs, cell }:
let
{
inputs,
cell,
}: let
namespace = "repo"; # ignore: unused
yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand
outputPath
{ inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; }
{
inherit yamlContent;
nativeBuildInputs = [pkgs.yq];
}
# run yq which outputs '.' (no filter) on file at yamlPath
# note that $out is passed onto the bash/sh script for execution
''
echo "$yamlContent" | yq >$out
'');
in
{
in {
fromYAML = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json"));
}

View File

@ -1 +0,0 @@

View File

@ -15,46 +15,47 @@
flake-utils,
nixpkgs,
}:
with flake-utils; lib.eachSystem lib.defaultSystems (sys: let
overlays = [turbo.overlay];
# pkgs is our tweaked nixpkgs
pkgs = import nixpkgs {
system = sys;
overlays = overlays;
};
shellMsg = ''
echo "Hello from nix ${sys}"
echo "Local development may use our remote planetscale database (pscale login && pnpm dev:infra; pnpm dev)"
echo "Or from the specified docker-compose.yml (pnpm dev:local_infra && pnpm dev)"
echo "See more on CONTRIBUTING.md"
'';
in {
devShell = pkgs.mkShell {
nativeBuildInputs = [pkgs.bashInteractive];
buildInputs = [
pkgs.nodejs-18_x
pkgs.nodePackages.pnpm
pkgs.nodePackages.prisma
pkgs.prisma-engines
pkgs.turbo
# pkgs.turbo-tooling
pkgs.jq
pkgs.pscale
pkgs.act # Github workflow
];
shellHook =
# https://github.com/prisma/prisma/issues/3026#issuecomment-927258138
# nix-direnv is required (impure build?) https://github.com/nix-community/nix-direnv
''
export PRISMA_MIGRATION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/migration-engine"
export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine"
export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node"
export PRISMA_INTROSPECTION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/introspection-engine"
export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt"
export TURBO_BINARY_PATH="${pkgs.turbo}/bin/turbo"
pnpm install
''
+ shellMsg;
};
});
with flake-utils;
lib.eachSystem lib.defaultSystems (sys: let
overlays = [turbo.overlay];
# pkgs is our tweaked nixpkgs
pkgs = import nixpkgs {
system = sys;
overlays = overlays;
};
shellMsg = ''
echo "Hello from nix ${sys}"
echo "Local development may use our remote planetscale database (pscale login && pnpm dev:infra; pnpm dev)"
echo "Or from the specified docker-compose.yml (pnpm dev:local_infra && pnpm dev)"
echo "See more on CONTRIBUTING.md"
'';
in {
devShell = pkgs.mkShell {
nativeBuildInputs = [pkgs.bashInteractive];
buildInputs = [
pkgs.nodejs-18_x
pkgs.nodePackages.pnpm
pkgs.nodePackages.prisma
pkgs.prisma-engines
pkgs.turbo
# pkgs.turbo-tooling
pkgs.jq
pkgs.pscale
pkgs.act # Github workflow
];
shellHook =
# https://github.com/prisma/prisma/issues/3026#issuecomment-927258138
# nix-direnv is required (impure build?) https://github.com/nix-community/nix-direnv
''
export PRISMA_MIGRATION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/migration-engine"
export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine"
export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node"
export PRISMA_INTROSPECTION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/introspection-engine"
export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt"
export TURBO_BINARY_PATH="${pkgs.turbo}/bin/turbo"
pnpm install
''
+ shellMsg;
};
});
}