mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
Compatibility, bringing Sumireko into the fold. Deprecate katexprs.
This commit is contained in:
parent
efae399c70
commit
40edeef897
39 changed files with 879 additions and 175 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@
|
|||
/result*
|
||||
/.direnv/
|
||||
/wiki
|
||||
.DS_Store
|
||||
|
|
|
|||
31
config/hosts/sumireko.nix
Normal file
31
config/hosts/sumireko.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{ config, pkgs, lib, meta, ... }: {
|
||||
imports = with meta; [
|
||||
profiles.darwin
|
||||
users.kat.darwin
|
||||
users.kat.dev
|
||||
];
|
||||
services.nix-daemon.enable = true;
|
||||
nix = {
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
package = pkgs.nixFlakes;
|
||||
};
|
||||
homebrew = {
|
||||
enable = true;
|
||||
brewPrefix = "/opt/homebrew/bin";
|
||||
casks = [
|
||||
"element"
|
||||
];
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
awscli
|
||||
jq
|
||||
];
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
system.stateVersion = 4;
|
||||
}
|
||||
54
config/modules/home/firewall.nix
Normal file
54
config/modules/home/firewall.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.network.firewall;
|
||||
in
|
||||
{
|
||||
options.network.firewall = {
|
||||
public.tcp.ports = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ ];
|
||||
};
|
||||
public.udp.ports = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ ];
|
||||
};
|
||||
private.tcp.ports = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ ];
|
||||
};
|
||||
private.udp.ports = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
public.tcp.ranges = mkOption {
|
||||
type = types.listOf (types.attrsOf types.port);
|
||||
default = [ ];
|
||||
};
|
||||
public.udp.ranges = mkOption {
|
||||
type = types.listOf (types.attrsOf types.port);
|
||||
default = [ ];
|
||||
};
|
||||
private.tcp.ranges = mkOption {
|
||||
type = types.listOf (types.attrsOf types.port);
|
||||
default = [ ];
|
||||
};
|
||||
private.udp.ranges = mkOption {
|
||||
type = types.listOf (types.attrsOf types.port);
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
public.interfaces = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "Public firewall interfaces";
|
||||
default = [ ];
|
||||
};
|
||||
private.interfaces = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "Private firewall interfaces";
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
}
|
||||
81
config/modules/home/network.nix
Normal file
81
config/modules/home/network.nix
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
{ config, nixos, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.network = {
|
||||
enable = mkEnableOption "Use kat's network module?";
|
||||
addresses = mkOption {
|
||||
type = with types; attrsOf (submodule ({ name, ... }: {
|
||||
options = {
|
||||
enable = mkEnableOption "Is the system a part of the ${name} network?";
|
||||
ipv4 = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
};
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
ipv6 = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
};
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
prefix = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
out = {
|
||||
identifierList = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = if config.enable then singleton config.domain ++ config.out.addressList else [ ];
|
||||
};
|
||||
addressList = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = if config.enable then concatMap (i: optional i.enable i.address) [ config.ipv4 config.ipv6 ] else [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
privateGateway = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
tf = {
|
||||
enable = mkEnableOption "Was the system provisioned by terraform?";
|
||||
ipv4_attr = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
ipv6_attr = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
dns = {
|
||||
enable = mkEnableOption "Do you want DNS to be semi-managed through this module?";
|
||||
isRoot = mkEnableOption "Is this system supposed to be the @ for the domain?";
|
||||
email = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
zone = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
dynamic = mkEnableOption "Enable Glauca Dynamic DNS Updater";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
network.addresses = nixos.network.addresses or {};
|
||||
network.privateGateway = nixos.network.privateGateway or "";
|
||||
network.tf = nixos.network.tf or {};
|
||||
network.dns = nixos.network.dns or {};
|
||||
};
|
||||
}
|
||||
17
config/profiles/darwin/home.nix
Normal file
17
config/profiles/darwin/home.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{ meta, config, inputs, tf, lib, ... }: with lib; {
|
||||
options.home-manager.users = mkOption {
|
||||
type = types.attrsOf (types.submoduleWith {
|
||||
modules = singleton meta.modules.home;
|
||||
specialArgs = {
|
||||
inherit inputs tf meta;
|
||||
nixos = config;
|
||||
};
|
||||
});
|
||||
};
|
||||
config = {
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
sd
|
||||
duc-cli
|
||||
bat
|
||||
exa-noman
|
||||
exa
|
||||
socat
|
||||
rsync
|
||||
wget
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ in
|
|||
yes = "me instead";
|
||||
};
|
||||
xdg.dataFile = { "z/.keep".text = ""; };
|
||||
home.packages = with pkgs; [ fzf fd zsh-completions akiflags ];
|
||||
home.packages = with pkgs; [ fzf fd zsh-completions ];
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableSyntaxHighlighting = true;
|
||||
|
|
@ -61,7 +61,10 @@ in
|
|||
HISTFILE=/persist/home/.zsh_history
|
||||
'' else ''
|
||||
''}
|
||||
${if pkgs.stdenv.system != "aarch64-darwin" then ''
|
||||
eval $(dircolors)
|
||||
'' else ''
|
||||
''}
|
||||
PROMPT_EOL_MARK='''
|
||||
ZSH_TAB_TITLE_ADDITIONAL_TERMS='foot'
|
||||
ZSH_TAB_TITLE_ENABLE_FULL_COMMAND=true
|
||||
|
|
@ -124,6 +127,9 @@ in
|
|||
src = "${pkgs.zsh-fzf-tab}/share/fzf-tab";
|
||||
});
|
||||
};
|
||||
home.sessionVariables = {
|
||||
XDG_DATA_HOME = "${config.xdg.dataHome}";
|
||||
};
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ set list listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:✖
|
|||
" Enable mouse
|
||||
set mouse=a
|
||||
|
||||
set viminfo='100000,<100000,s1000,h,n$XDG_DATA_HOME/vim/viminfo'
|
||||
set viminfo='100000,<100000,s1000,h,n~/.local/share/vim/viminfo'
|
||||
set ts=2
|
||||
set sw=2
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
{ config, lib, pkgs, nixos, ... }: with lib;
|
||||
|
||||
let initvim = pkgs.callPackage
|
||||
({ stdenv, elinks, nodejs }: stdenv.mkDerivation {
|
||||
({ stdenv, nodejs }: stdenv.mkDerivation {
|
||||
name = "init.vim";
|
||||
src = ./init.vim;
|
||||
inherit nodejs elinks;
|
||||
inherit nodejs;
|
||||
buildInputs = [
|
||||
elinks
|
||||
nodejs
|
||||
];
|
||||
phases = [ "buildPhase" ];
|
||||
|
|
|
|||
14
config/users/kat/darwin.nix
Normal file
14
config/users/kat/darwin.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ config, pkgs, ... }: {
|
||||
users.users.kat = {
|
||||
name = "kat";
|
||||
home = "/Users/kat";
|
||||
shell = pkgs.zsh;
|
||||
uid = 501;
|
||||
};
|
||||
users.knownUsers = [
|
||||
"kat"
|
||||
];
|
||||
home-manager.users.kat.programs.zsh.initExtraFirst = ''
|
||||
source /etc/static/zshrc
|
||||
'';
|
||||
}
|
||||
|
|
@ -10,9 +10,16 @@
|
|||
serviceImports = wrapImports tree.prev.services;
|
||||
in
|
||||
dirImports // {
|
||||
darwin = {
|
||||
imports = [
|
||||
dirImports.base
|
||||
tree.prev.darwin
|
||||
];
|
||||
};
|
||||
base = {
|
||||
imports = [
|
||||
dirImports.base
|
||||
dirImports.linux
|
||||
tree.prev.nixos
|
||||
];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
tokei
|
||||
nixpkgs-fmt
|
||||
pandoc
|
||||
apache-directory-studio
|
||||
hugo
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
let
|
||||
initvim = pkgs.callPackage
|
||||
({ stdenv, elinks, nodejs }: stdenv.mkDerivation {
|
||||
({ stdenv, nodejs }: stdenv.mkDerivation {
|
||||
name = "init.vim";
|
||||
src = ./init.vim;
|
||||
inherit nodejs elinks;
|
||||
inherit nodejs;
|
||||
buildInputs = [
|
||||
elinks
|
||||
nodejs
|
||||
];
|
||||
phases = [ "buildPhase" ];
|
||||
|
|
@ -44,10 +43,6 @@ in
|
|||
nvim-base16
|
||||
nvim-web-devicons
|
||||
telescope-nvim
|
||||
(nvim-treesitter.withPlugins (
|
||||
plugins: with plugins; pkgs.tree-sitter.allGrammars
|
||||
))
|
||||
nvim-ts-rainbow
|
||||
coc-yaml
|
||||
coc-git
|
||||
coc-css
|
||||
|
|
|
|||
|
|
@ -14,22 +14,6 @@ lua << EOF
|
|||
}
|
||||
})
|
||||
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ignore_install = { }, -- List of parsers to ignore installing
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
rainbow = {
|
||||
enable = true,
|
||||
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
||||
max_file_lines = nil, -- Do not enable for files with more than n lines, int
|
||||
}
|
||||
}
|
||||
require('neorg').setup {
|
||||
-- Tell Neorg what modules to load
|
||||
load = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
xdg = {
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
{ config, pkgs, lib, ... }: {
|
||||
services.nix-daemon.enable = true;
|
||||
nix = {
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
package = pkgs.nixFlakes;
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
awscli
|
||||
];
|
||||
system.stateVersion = 4;
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
{ config, ... }: {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
{ config, pkgs, ... }: {
|
||||
home.packages = with pkgs; [
|
||||
];
|
||||
}
|
||||
|
|
@ -32,6 +32,10 @@ let
|
|||
nix flake lock ./trusted --update-input trusted
|
||||
fi
|
||||
'';
|
||||
sumireko-apply = pkgs.writeShellScriptBin "sumireko-apply" ''
|
||||
nix build ${./.}#darwinConfigurations.sumireko.system
|
||||
darwin-rebuild switch --flake ${./.}#sumireko
|
||||
'';
|
||||
in
|
||||
with lib; pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
|
|
@ -39,6 +43,7 @@ with lib; pkgs.mkShell {
|
|||
nf-actions
|
||||
nf-actions-test
|
||||
nf-update
|
||||
sumireko-apply
|
||||
] ++ config.runners.lazy.nativeBuildInputs
|
||||
++ (map
|
||||
(node: writeShellScriptBin "${node.networking.hostName}-sd-img" ''
|
||||
|
|
|
|||
86
flake.lock
generated
86
flake.lock
generated
|
|
@ -51,6 +51,27 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs-darwin"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1648278671,
|
||||
"narHash": "sha256-1WrR9ex+rKTjZtODNUZQhkWYUprtfOkjOyo9YWL2NMs=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "4fdbb8168f61d31d3f90bb0d07f48de709c4fe79",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lnl7",
|
||||
"ref": "master",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"doom-emacs": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
@ -86,11 +107,11 @@
|
|||
},
|
||||
"emacs-overlay": {
|
||||
"locked": {
|
||||
"lastModified": 1649647100,
|
||||
"narHash": "sha256-JjIQlPUohatoXJWgC/QATwQ7GBf78fEOXiPm4WT7vIQ=",
|
||||
"lastModified": 1649732714,
|
||||
"narHash": "sha256-D8iDZsLJWXB4n/Iy/KCpgdKSLFff2rynCeohO7Xs3R0=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "4392b4c2b738c2447b796be2e27bb00d97aa0522",
|
||||
"rev": "8b7323d06cc5310f75781ae87dd50840c3b2bfc7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -214,11 +235,11 @@
|
|||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1648297722,
|
||||
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
|
||||
"lastModified": 1649676176,
|
||||
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
|
||||
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -314,44 +335,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"katexprs": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1641402064,
|
||||
"narHash": "sha256-YwyYTkZqBgM/SKxu5rLGcL67NqHaTI/mUzvYaYtHN/M=",
|
||||
"owner": "kittywitch",
|
||||
"repo": "nixexprs",
|
||||
"rev": "706856839b5d1bbe4b1f9ba32842ce86dd21989c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kittywitch",
|
||||
"ref": "main",
|
||||
"repo": "nixexprs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs-darwin"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1648278671,
|
||||
"narHash": "sha256-1WrR9ex+rKTjZtODNUZQhkWYUprtfOkjOyo9YWL2NMs=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "4fdbb8168f61d31d3f90bb0d07f48de709c4fe79",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lnl7",
|
||||
"ref": "master",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-dns": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
|
|
@ -448,11 +431,11 @@
|
|||
},
|
||||
"nixpkgs-darwin": {
|
||||
"locked": {
|
||||
"lastModified": 1649541905,
|
||||
"narHash": "sha256-e8uePwD302weU4saoLg5uhb0yI5ZbHl/L49ncKejh5o=",
|
||||
"lastModified": 1649675302,
|
||||
"narHash": "sha256-joXkXjdOn73GF/1Y3mhir44aG5doekJyJwiG3DblIlo=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "db81927829becddb57db2b3b3e34301ed4af8d0a",
|
||||
"rev": "a31e3437d3b5d8f0b4f3bbc3b097b15b10250dab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -480,11 +463,11 @@
|
|||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1649669925,
|
||||
"narHash": "sha256-9NbeOUhAVsRhwN4YMtqJznYyO/1xSUgWfOCmOHg+vOQ=",
|
||||
"lastModified": 1649749110,
|
||||
"narHash": "sha256-gN/BkRu93GDHGENao+G0oHrknSJB3l+sfGOZWkqG2RY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nur",
|
||||
"rev": "6902d2d240c9afbece10014e8df1ab3df453e509",
|
||||
"rev": "287aa9ab138e00c3a3519e437a56b7627c62c478",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -595,14 +578,13 @@
|
|||
"anicca": "anicca",
|
||||
"arcexprs": "arcexprs",
|
||||
"ci": "ci",
|
||||
"darwin": "darwin",
|
||||
"emacs-overlay": "emacs-overlay",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"home-manager": "home-manager",
|
||||
"home-manager-darwin": "home-manager-darwin",
|
||||
"impermanence": "impermanence",
|
||||
"katexprs": "katexprs",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nix-dns": "nix-dns",
|
||||
"nix-doom-emacs": "nix-doom-emacs",
|
||||
"nixpkgs": "nixpkgs",
|
||||
|
|
|
|||
34
flake.nix
34
flake.nix
|
|
@ -15,17 +15,13 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
impermanence.url = "github:nix-community/impermanence/master";
|
||||
katexprs = {
|
||||
url = "github:kittywitch/nixexprs/main";
|
||||
flake = false;
|
||||
};
|
||||
anicca = {
|
||||
url = "github:kittywitch/anicca/main";
|
||||
flake = false;
|
||||
};
|
||||
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-21.11-darwin";
|
||||
nix-darwin.url = "github:lnl7/nix-darwin/master";
|
||||
nix-darwin.inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||
darwin.url = "github:lnl7/nix-darwin/master";
|
||||
darwin.inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||
home-manager-darwin.url = "github:nix-community/home-manager";
|
||||
home-manager-darwin.inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||
nix-dns = {
|
||||
|
|
@ -53,23 +49,31 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, nix-darwin, home-manager-darwin, ... }@inputs: {
|
||||
darwinConfigurations."sumireko" = nix-darwin.lib.darwinSystem {
|
||||
system = "aarch64-darwin";
|
||||
modules = [
|
||||
outputs = { self, nixpkgs, flake-utils, darwin, home-manager-darwin, ... }@inputs: {
|
||||
darwinConfigurations."sumireko" = let
|
||||
system = "aarch64-darwin";
|
||||
meta = self.legacyPackages.${system};
|
||||
in darwin.lib.darwinSystem {
|
||||
inherit inputs;
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs meta;
|
||||
tf = { };
|
||||
};
|
||||
pkgs = self.legacyPackages.${system}.darwin-pkgs;
|
||||
modules = with meta; [
|
||||
home-manager-darwin.darwinModules.home-manager
|
||||
./darwin/configuration.nix
|
||||
./darwin/home-base.nix
|
||||
{ home-manager.users.kat = import ./darwin/home.nix; }
|
||||
];
|
||||
meta.hosts.sumireko
|
||||
];
|
||||
};
|
||||
} //
|
||||
(flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system}; in
|
||||
{
|
||||
rec {
|
||||
devShell = import ./devShell.nix { inherit inputs system; };
|
||||
legacyPackages = import ./outputs.nix { inherit inputs system; };
|
||||
nixosConfigurations = legacyPackages.network.nodes;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
optionalAttrs = cond: as: if cond then as else { };
|
||||
|
||||
pkgs = import ./overlays { inherit inputs system; };
|
||||
darwin-pkgs = import ./overlays/darwin.nix { inherit inputs system; };
|
||||
inherit (pkgs) lib;
|
||||
|
||||
mkTree = import ./tree.nix { inherit lib; };
|
||||
|
|
@ -13,7 +14,6 @@
|
|||
functor = {
|
||||
enable = true;
|
||||
external = [
|
||||
(import (inputs.katexprs + "/modules")).nixos
|
||||
(import (inputs.impermanence + "/nixos.nix"))
|
||||
(import inputs.anicca).modules.nixos
|
||||
(inputs.tf-nix + "/modules/nixos/secrets.nix")
|
||||
|
|
@ -48,7 +48,6 @@
|
|||
enable = true;
|
||||
external = [
|
||||
(import (inputs.arcexprs + "/modules")).home-manager
|
||||
(import (inputs.katexprs + "/modules")).home
|
||||
(import (inputs.impermanence + "/home-manager.nix"))
|
||||
(import inputs.anicca).modules.home
|
||||
(inputs.tf-nix + "/modules/home/secrets.nix")
|
||||
|
|
@ -102,7 +101,7 @@
|
|||
};
|
||||
};
|
||||
})
|
||||
(lib.attrNames xarg.hosts));
|
||||
(lib.remove "sumireko" (lib.attrNames xarg.hosts)));
|
||||
|
||||
specialArgs = {
|
||||
inherit inputs root tree;
|
||||
|
|
@ -113,6 +112,6 @@
|
|||
inherit (eval) config;
|
||||
|
||||
|
||||
self = config // { inherit pkgs lib inputs tree; } // xarg;
|
||||
self = config // { inherit pkgs lib inputs tree darwin-pkgs; } // xarg;
|
||||
in
|
||||
self
|
||||
|
|
|
|||
27
overlays/darwin.nix
Normal file
27
overlays/darwin.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ inputs, system ? builtins.currentSystem, ... }@args:
|
||||
|
||||
let
|
||||
pkgs = import inputs.nixpkgs-darwin {
|
||||
inherit system;
|
||||
overlays = [
|
||||
(import ./nur { inherit inputs; })
|
||||
(import inputs.emacs-overlay)
|
||||
(import ./dns { inherit inputs; })
|
||||
(import ./local)
|
||||
(import ./lib)
|
||||
] ++ (map (path: import "${path}/overlay.nix") [
|
||||
inputs.arcexprs
|
||||
inputs.anicca
|
||||
]);
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowBroken = true;
|
||||
allowUnsupportedSystem = true;
|
||||
permittedInsecurePackages = [
|
||||
"ffmpeg-3.4.8"
|
||||
"ffmpeg-2.8.17"
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
pkgs
|
||||
|
|
@ -8,9 +8,9 @@ let
|
|||
(import inputs.emacs-overlay)
|
||||
(import ./dns { inherit inputs; })
|
||||
(import ./local)
|
||||
(import ./lib)
|
||||
] ++ (map (path: import "${path}/overlay.nix") [
|
||||
inputs.arcexprs
|
||||
inputs.katexprs
|
||||
inputs.anicca
|
||||
]);
|
||||
config = {
|
||||
|
|
|
|||
25
overlays/lib/color-helpers.nix
Normal file
25
overlays/lib/color-helpers.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{ lib }: rec {
|
||||
hexChars =
|
||||
[ "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f" ];
|
||||
hexCharToInt = char:
|
||||
let
|
||||
pairs = lib.imap0 (lib.flip lib.nameValuePair) hexChars;
|
||||
idx = builtins.listToAttrs pairs;
|
||||
in
|
||||
idx.${lib.toLower char};
|
||||
hexToInt = str:
|
||||
lib.foldl (value: chr: value * 16 + hexCharToInt chr) 0
|
||||
(lib.stringToCharacters str);
|
||||
hextorgba = hex: alpha:
|
||||
(
|
||||
let
|
||||
r_hex = lib.substring 1 2 hex;
|
||||
g_hex = lib.substring 3 2 hex;
|
||||
b_hex = lib.substring 5 2 hex;
|
||||
r_dec = hexToInt r_hex;
|
||||
g_dec = hexToInt g_hex;
|
||||
b_dec = hexToInt b_hex;
|
||||
in
|
||||
"rgba(${toString r_dec}, ${toString g_dec}, ${toString b_dec}, ${toString alpha})"
|
||||
);
|
||||
}
|
||||
7
overlays/lib/default.nix
Normal file
7
overlays/lib/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
self: super: {
|
||||
lib = super.lib.extend (self: super: import ./overlay.nix {
|
||||
inherit super;
|
||||
lib = self;
|
||||
isOverlayLib = true;
|
||||
});
|
||||
}
|
||||
13
overlays/lib/domain-merge.nix
Normal file
13
overlays/lib/domain-merge.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ lib }: { folder, defaultFile ? "default.nix", folderPaths ? [ ] }: with lib; let
|
||||
defaultFileFinal =
|
||||
if (defaultFile == "default.nix" && folder == "hosts") then
|
||||
"nixos.nix"
|
||||
else defaultFile;
|
||||
folderModLists = map
|
||||
(folderPath: modList {
|
||||
modulesDir = folderPath;
|
||||
defaultFile = defaultFileFinal;
|
||||
})
|
||||
(filter builtins.pathExists folderPaths);
|
||||
in
|
||||
foldl modListMerge { } folderModLists
|
||||
7
overlays/lib/folder-list.nix
Normal file
7
overlays/lib/folder-list.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ lib }: path: excludes:
|
||||
let
|
||||
filterAttrNamesToList = filter: set:
|
||||
lib.foldl' (a: b: a ++ b) [ ]
|
||||
(map (e: if (filter e set.${e}) then [ e ] else [ ]) (lib.attrNames set));
|
||||
in
|
||||
(filterAttrNamesToList (name: type: ! (builtins.elem name excludes) && type == "directory") (builtins.readDir path))
|
||||
5
overlays/lib/intersect-merge.nix
Normal file
5
overlays/lib/intersect-merge.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ lib }: pathsA: pathsB: with lib; let
|
||||
pathIntersection = intersectLists (attrNames pathsA) (attrNames pathsB);
|
||||
pathMerger = pathA: pathB: { imports = [ pathA pathB ]; };
|
||||
in
|
||||
pathsA // pathsB // genAttrs pathIntersection (key: (pathMerger pathsA.${key} pathsB.${key}))
|
||||
29
overlays/lib/module-list.nix
Normal file
29
overlays/lib/module-list.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ lib }: { modulesDir, defaultFile ? "default.nix", importAll ? false }:
|
||||
|
||||
with builtins;
|
||||
|
||||
let
|
||||
isModule = m: lib.isFunction m && (m.isModule or true);
|
||||
filterAttrNamesToList = filter: set:
|
||||
foldl' (a: b: a ++ b) [ ]
|
||||
(map (e: if (filter e set.${e}) then [ e ] else [ ]) (attrNames set));
|
||||
nameValuePair = name: value: { inherit name value; };
|
||||
listToAttrs = foldl' (acc: val: acc // { ${val.name} = val.value; }) { };
|
||||
directories =
|
||||
filterAttrNamesToList (_: type: type == "directory") (readDir modulesDir);
|
||||
files = map (dir: nameValuePair dir (modulesDir + "/${dir}/${defaultFile}"))
|
||||
(filter (f: builtins.pathExists (modulesDir + "/${f}/${defaultFile}")) directories);
|
||||
modules = map
|
||||
({ name, value }:
|
||||
# if the file contains a function, assume it to be a module and pass the path
|
||||
# (for dedup and such). if it contains anything else, pass that.
|
||||
let m = import value;
|
||||
in
|
||||
{
|
||||
inherit name;
|
||||
value = if lib.isFunction m && ! isModule m then m { inherit lib; } else if isModule m && !importAll then value else m;
|
||||
})
|
||||
files;
|
||||
modList = (listToAttrs modules);
|
||||
in
|
||||
modList
|
||||
21
overlays/lib/node-import.nix
Normal file
21
overlays/lib/node-import.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{ lib }: { nixosImports, homeImports, users, hostName, profiles }: with lib;
|
||||
|
||||
let
|
||||
importLists = {
|
||||
nixos = nixosImports;
|
||||
home = homeImports;
|
||||
};
|
||||
replacedLists = mapAttrs
|
||||
(_: fileList:
|
||||
map (builtins.replaceStrings [ "HN" ] [ "${hostName}" ]) fileList
|
||||
)
|
||||
importLists;
|
||||
homeScaffold = user: {
|
||||
home-manager.users.${user} = {
|
||||
imports = filter builtins.pathExists replacedLists.home;
|
||||
};
|
||||
};
|
||||
scaffoldedUsers = map homeScaffold users;
|
||||
baseProfile = singleton profiles.base;
|
||||
in
|
||||
filter builtins.pathExists replacedLists.nixos ++ baseProfile ++ scaffoldedUsers
|
||||
23
overlays/lib/overlay.nix
Normal file
23
overlays/lib/overlay.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ pkgs ? import <nixpkgs> { }
|
||||
, lib ? pkgs.lib
|
||||
# for internal use...
|
||||
, super ? if !isOverlayLib then lib else { }
|
||||
, self ? if isOverlayLib then lib else { }
|
||||
, before ? if !isOverlayLib then lib else { }
|
||||
, isOverlayLib ? false
|
||||
}@args:
|
||||
let
|
||||
colorHelpers = import ./color-helpers.nix { inherit lib; };
|
||||
lib = before // katlib // self;
|
||||
katlib = with before; with katlib; with self;
|
||||
{
|
||||
inherit (colorHelpers) hextorgba;
|
||||
nodeImport = import ./node-import.nix { inherit lib; };
|
||||
virtualHostGen = import ./virtual-host-gen.nix { inherit lib; };
|
||||
domainMerge = import ./domain-merge.nix { inherit lib; };
|
||||
modListMerge = import ./intersect-merge.nix { inherit lib; };
|
||||
modList = import ./module-list.nix { inherit lib; };
|
||||
folderList = import ./folder-list.nix { inherit lib; };
|
||||
};
|
||||
in
|
||||
katlib
|
||||
11
overlays/lib/virtual-host-gen.nix
Normal file
11
overlays/lib/virtual-host-gen.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ lib }: { config, networkFilter ? [ ], addresses ? [ ], block }: with lib;
|
||||
|
||||
let
|
||||
networks = config.network.addresses;
|
||||
filteredNetworks = filterAttrs (n: v: elem n networkFilter) networks;
|
||||
networkValues = attrValues filteredNetworks;
|
||||
addressList' = concatMap (n: n.out.identifierList) networkValues;
|
||||
addressList = map (n: builtins.unsafeDiscardStringContext n) addressList';
|
||||
hostBlocks = map (host: nameValuePair host block) addressList;
|
||||
in
|
||||
listToAttrs hostBlocks
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
final: prev: {
|
||||
vips = prev.vips.override { libjxl = null; };
|
||||
kat-hugosite = final.callPackage ./kat-hugosite.nix { };
|
||||
sway-scrot = final.callPackage ./sway-scrot { };
|
||||
vfio-vm = final.callPackage ./vm.nix { };
|
||||
vfio-vm-pinning = final.callPackage ./vm-pinning.nix { };
|
||||
vfio-disk-mapper = final.callPackage ./disk-mapper.nix { };
|
||||
|
|
|
|||
63
overlays/local/exa-noman/default.nix
Normal file
63
overlays/local/exa-noman/default.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, rustPlatform
|
||||
, cmake
|
||||
, pkg-config
|
||||
, zlib
|
||||
, installShellFiles
|
||||
, Security
|
||||
, libiconv
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "exa";
|
||||
version = "0.10.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ogham";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-vChsy/FrJEzTO5O+XFycPMP3jqOeea/hfsC0jJbqUVI=";
|
||||
};
|
||||
|
||||
# Cargo.lock is outdated
|
||||
cargoPatches = [ ./update-cargo-lock.diff ];
|
||||
|
||||
cargoSha256 = "sha256-ah8IjShmivS6IWL3ku/4/j+WNr/LdUnh1YJnPdaFdcM=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
pkg-config
|
||||
installShellFiles
|
||||
];
|
||||
|
||||
buildInputs = [ zlib ] ++ lib.optionals stdenv.isDarwin [ libiconv Security ];
|
||||
outputs = [ "out" ];
|
||||
|
||||
postInstall = ''
|
||||
installShellCompletion \
|
||||
--name exa completions/completions.bash \
|
||||
--name exa.fish completions/completions.fish \
|
||||
--name _exa completions/completions.zsh
|
||||
'';
|
||||
|
||||
# Some tests fail, but Travis ensures a proper build
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Replacement for 'ls' written in Rust";
|
||||
longDescription = ''
|
||||
exa is a modern replacement for ls. It uses colours for information by
|
||||
default, helping you distinguish between many types of files, such as
|
||||
whether you are the owner, or in the owning group. It also has extra
|
||||
features not present in the original ls, such as viewing the Git status
|
||||
for a directory, or recursing into directories with a tree view. exa is
|
||||
written in Rust, so it’s small, fast, and portable.
|
||||
'';
|
||||
changelog = "https://github.com/ogham/exa/releases/tag/v${version}";
|
||||
homepage = "https://the.exa.website";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ ehegnes lilyball globin fortuneteller2k ];
|
||||
};
|
||||
}
|
||||
13
overlays/local/exa-noman/update-cargo-lock.diff
Normal file
13
overlays/local/exa-noman/update-cargo-lock.diff
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index df94188..ed3a068 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -57,7 +57,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "exa"
|
||||
-version = "0.11.0-pre"
|
||||
+version = "0.10.1"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"datetime",
|
||||
5
overlays/local/sway-scrot/default.nix
Normal file
5
overlays/local/sway-scrot/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ wrapShellScriptBin, pkgs }:
|
||||
|
||||
wrapShellScriptBin "sway-scrot" ./sway-scrot.sh {
|
||||
depsRuntimePath = with pkgs; [ coreutils wl-clipboard slurp grim sway jq libnotify xdotool maim xclip ];
|
||||
}
|
||||
253
overlays/local/sway-scrot/sway-scrot.sh
Executable file
253
overlays/local/sway-scrot/sway-scrot.sh
Executable file
|
|
@ -0,0 +1,253 @@
|
|||
#!/bin/sh
|
||||
|
||||
## Requirements:
|
||||
## - `grim`: screenshot utility for wayland
|
||||
## - `slurp`: to select an area
|
||||
## - `$MSGER`: to read properties of current window
|
||||
## - `$COPIER`: clipboard utility
|
||||
## - `jq`: json utility to parse $MSGER output
|
||||
## - `notify-send`: to show notifications
|
||||
|
||||
getTargetDirectory() {
|
||||
echo "/home/kat/media/scrots"
|
||||
}
|
||||
|
||||
if [ -n "$SWAYSOCK" ]; then
|
||||
SWAY=yes;
|
||||
MSGER=swaymsg;
|
||||
COPIER="wl-copy";
|
||||
COPIERIMG="wl-copy --type image/png";
|
||||
else
|
||||
SWAY=no;
|
||||
MSGER=i3-msg;
|
||||
COPIER="xclip -sel c"
|
||||
COPIERIMG="xclip -sel c -t image/png"
|
||||
fi
|
||||
|
||||
if [ "$1" = "--notify" ]; then
|
||||
NOTIFY=yes
|
||||
shift 1
|
||||
else
|
||||
NOTIFY=no
|
||||
fi
|
||||
|
||||
ACTION=${1:-usage}
|
||||
SUBJECT=${2:-screen}
|
||||
FILENAME="$(date -Ins).png"
|
||||
FILE=${3:-$(getTargetDirectory)/$FILENAME}
|
||||
|
||||
TOKEN=$(bitw get secrets/xbackbone -f token)
|
||||
|
||||
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ] && [ "$ACTION" != "upload" ] && [ "$ACTION" != "copys" ]; then
|
||||
echo "Usage:"
|
||||
echo " kat-scrot [--notify] (copy|save|upload|copys) [active|screen|output|area|window] [FILE]"
|
||||
echo " kat-scrot check"
|
||||
echo " kat-scrot usage"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " copy: Copy the screenshot data into the clipboard."
|
||||
echo " upload: Uses SCP to transfer the screenshot to a remote server."
|
||||
echo " copys: Copy the screenshot data into the clipboard and save it to a regular file."
|
||||
echo " save: Save the screenshot to a regular file."
|
||||
echo " check: Verify if required tools are installed and exit."
|
||||
echo " usage: Show this message and exit."
|
||||
echo ""
|
||||
echo "Targets:"
|
||||
echo " active: Currently active window."
|
||||
echo " screen: All visible outputs."
|
||||
echo " output: Currently active output."
|
||||
echo " area: Manually select a region."
|
||||
echo " window: Manually select a window."
|
||||
exit
|
||||
fi
|
||||
|
||||
notify() {
|
||||
notify-send -t 3000 -a grimshot "$@"
|
||||
}
|
||||
notifyOk() {
|
||||
[ "$NOTIFY" = "no" ] && return
|
||||
|
||||
TITLE=${2:-"Screenshot"}
|
||||
MESSAGE=${1:-"OK"}
|
||||
notify "$TITLE" "$MESSAGE"
|
||||
}
|
||||
notifyError() {
|
||||
if [ $NOTIFY = "yes" ]; then
|
||||
TITLE=${2:-"Screenshot"}
|
||||
MESSAGE=${1:-"Error taking screenshot with grim"}
|
||||
notify -u critical "$TITLE" "$MESSAGE"
|
||||
else
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
|
||||
die() {
|
||||
MSG=${1:-Bye}
|
||||
notifyError "Error: $MSG"
|
||||
exit 2
|
||||
}
|
||||
|
||||
check() {
|
||||
COMMAND=$1
|
||||
if command -v "$COMMAND" > /dev/null 2>&1; then
|
||||
RESULT="OK"
|
||||
else
|
||||
RESULT="NOT FOUND"
|
||||
fi
|
||||
echo " $COMMAND: $RESULT"
|
||||
}
|
||||
|
||||
takeScreenshot() {
|
||||
FILE=$1
|
||||
GEOM=$2
|
||||
OUTPUT=$3
|
||||
if [ "$SWAY" = "yes" ]; then
|
||||
if [ ! -z "$OUTPUT" ]; then
|
||||
grim -o "$OUTPUT" "$FILE" || die "Unable to invoke grim"
|
||||
elif [ -z "$GEOM" ]; then
|
||||
grim "$FILE" || die "Unable to invoke grim"
|
||||
else
|
||||
grim -g "$GEOM" "$FILE" || die "Unable to invoke grim"
|
||||
fi
|
||||
else
|
||||
if [ "$GEOM" = "maim-cur" ]; then
|
||||
maim -i $(xdotool getactivewindow) "$FILE"
|
||||
elif [ "$GEOM" = "maim-s" ]; then
|
||||
maim -s "$FILE"
|
||||
elif [ "$GEOM" = "maim-out" ]; then
|
||||
maim -g "$OUTPUT" "$FILE"
|
||||
elif [ "$GEOM" = "maim-screen" ]; then
|
||||
maim "$FILE"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$ACTION" = "check" ] ; then
|
||||
echo "Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH..."
|
||||
check grim
|
||||
check slurp
|
||||
check $MSGER
|
||||
check $COPIER
|
||||
check jq
|
||||
check notify-send
|
||||
exit
|
||||
elif [ "$SUBJECT" = "area" ] ; then
|
||||
GEOM=$(slurp -d)
|
||||
# Check if user exited slurp without selecting the area
|
||||
if [ -z "$GEOM" ]; then
|
||||
exit
|
||||
fi
|
||||
WHAT="Area"
|
||||
elif [ "$SUBJECT" = "active" ] ; then
|
||||
if [ "$SWAY" = "yes" ]; then
|
||||
FOCUSED=$($MSGER -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)')
|
||||
GEOM=$(echo "$FOCUSED" | jq -r '.rect | "\(.x),\(.y) \(.width)x\(.height)"')
|
||||
APP_ID=$(echo "$FOCUSED" | jq -r '.app_id')
|
||||
WHAT="$APP_ID window"
|
||||
else
|
||||
GEOM="maim-cur"
|
||||
fi
|
||||
elif [ "$SUBJECT" = "screen" ] ; then
|
||||
if [ "$SWAY" = "yes" ]; then
|
||||
GEOM=""
|
||||
WHAT="Screen"
|
||||
else
|
||||
GEOM="maim-screen";
|
||||
fi
|
||||
elif [ "$SUBJECT" = "output" ] ; then
|
||||
if [ "$SWAY" = "yes" ]; then
|
||||
GEOM=""
|
||||
OUTPUT=$($MSGER -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name')
|
||||
WHAT="$OUTPUT"
|
||||
else
|
||||
MONITORS=$(xrandr | grep -o '[0-9]*x[0-9]*[+-][0-9]*[+-][0-9]*')
|
||||
# Get the location of the mouse
|
||||
XMOUSE=$(xdotool getmouselocation | awk -F "[: ]" '{print $2}')
|
||||
YMOUSE=$(xdotool getmouselocation | awk -F "[: ]" '{print $4}')
|
||||
|
||||
for mon in ${MONITORS}; do
|
||||
# Parse the geometry of the monitor
|
||||
MONW=$(echo ${mon} | awk -F "[x+]" '{print $1}')
|
||||
MONH=$(echo ${mon} | awk -F "[x+]" '{print $2}')
|
||||
MONX=$(echo ${mon} | awk -F "[x+]" '{print $3}')
|
||||
MONY=$(echo ${mon} | awk -F "[x+]" '{print $4}')
|
||||
# Use a simple collision check
|
||||
if (( ${XMOUSE} >= ${MONX} )); then
|
||||
if (( ${XMOUSE} <= ${MONX}+${MONW} )); then
|
||||
if (( ${YMOUSE} >= ${MONY} )); then
|
||||
if (( ${YMOUSE} <= ${MONY}+${MONH} )); then
|
||||
# We have found our monitor!
|
||||
GEOM="maim-out"
|
||||
OUTPUT="${MONW}x${MONH}+${MONX}+${MONY}"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
elif [ "$SUBJECT" = "window" ] ; then
|
||||
if [ "$SWAY" = "yes" ]; then
|
||||
GEOM=$($MSGER -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)
|
||||
else
|
||||
GEOM="maim-s"
|
||||
fi
|
||||
# Check if user exited slurp without selecting the area
|
||||
if [ -z "$GEOM" ]; then
|
||||
exit
|
||||
fi
|
||||
WHAT="Window"
|
||||
else
|
||||
die "Unknown subject to take a screen shot from" "$SUBJECT"
|
||||
fi
|
||||
|
||||
if [ "$ACTION" = "copy" ] ; then
|
||||
takeScreenshot - "$GEOM" "$OUTPUT" | $COPIERIMG || die "Clipboard error"
|
||||
echo $FILE
|
||||
notifyOk "$WHAT copied to buffer"
|
||||
elif [ "$ACTION" = "copys" ]; then
|
||||
if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
|
||||
TITLE="Screenshot of $SUBJECT"
|
||||
MESSAGE=$(basename "$FILE")
|
||||
notifyOk "$MESSAGE" "$TITLE"
|
||||
echo $FILE
|
||||
cat "$FILE" | $COPIER || die "Clipboard error"
|
||||
else
|
||||
notifyError "Error taking screenshot with grim"
|
||||
fi
|
||||
elif [ "$ACTION" = "upload" ]; then
|
||||
if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
|
||||
RESPONSE="$(curl -s -F "token=$TOKEN" -F "upload=@\"$FILE\"" https://files.kittywit.ch/upload)";
|
||||
if [[ "$(echo "${RESPONSE}" | jq -r '.message')" == "OK" ]]; then
|
||||
URL="$(echo "${RESPONSE}" | jq -r '.url')/raw";
|
||||
echo "${URL}" | $COPIER;
|
||||
echo "${URL}";
|
||||
notify-send "Upload completed!" "${URL}";
|
||||
exit 0;
|
||||
else
|
||||
MESSAGE="$(echo "${RESPONSE}" | jq -r '.message')";
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Unexpected response:";
|
||||
echo "${RESPONSE}";
|
||||
exit 1;
|
||||
fi
|
||||
if [ "${DESKTOP_SESSION}" != "" ]; then
|
||||
notify-send "Error!" "${MESSAGE}";
|
||||
else
|
||||
echo "Error! ${MESSAGE}";
|
||||
fi
|
||||
exit 1;
|
||||
fi
|
||||
else
|
||||
notifyError "Error taking screenshot with grim"
|
||||
fi
|
||||
else
|
||||
if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
|
||||
TITLE="Screenshot of $SUBJECT"
|
||||
MESSAGE=$(basename "$FILE")
|
||||
notifyOk "$MESSAGE" "$TITLE"
|
||||
echo $FILE
|
||||
else
|
||||
notifyError "Error taking screenshot with grim"
|
||||
fi
|
||||
fi
|
||||
146
trusted/flake.lock
generated
146
trusted/flake.lock
generated
|
|
@ -20,11 +20,11 @@
|
|||
"arcexprs": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1637367152,
|
||||
"narHash": "sha256-6M3dJuONcD9INaBxFlx6U/nd057PD8/NlMN1jacsJE0=",
|
||||
"lastModified": 1649357469,
|
||||
"narHash": "sha256-lJFMdc+ZYRZbs4zWzUhTAByiquqOfNx8Z1RQ50zdj+I=",
|
||||
"owner": "arcnmx",
|
||||
"repo": "nixexprs",
|
||||
"rev": "2e83baee2826fe6576304a1a70ada5b642abb1a9",
|
||||
"rev": "53f5058ed9b28b040b2640efde3127c19ca8ef65",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -37,11 +37,11 @@
|
|||
"ci": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1636054324,
|
||||
"narHash": "sha256-gNC+hYvnTHcUb/7VXJkFMrD4hTPJqcBnuRxEApHH0I4=",
|
||||
"lastModified": 1643398418,
|
||||
"narHash": "sha256-j7Z+k1dUg65vvBhME+c3ve1Oxlu5GeI4oNwdo1NGL10=",
|
||||
"owner": "arcnmx",
|
||||
"repo": "ci",
|
||||
"rev": "fa2cbfb784af2c89cb9af1961bda142ea6e37268",
|
||||
"rev": "1d38e73657284793de5251738adbe2c04a151c08",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -51,6 +51,28 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixfiles",
|
||||
"nixpkgs-darwin"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1648278671,
|
||||
"narHash": "sha256-1WrR9ex+rKTjZtODNUZQhkWYUprtfOkjOyo9YWL2NMs=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "4fdbb8168f61d31d3f90bb0d07f48de709c4fe79",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lnl7",
|
||||
"ref": "master",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"doom-emacs": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
@ -86,11 +108,11 @@
|
|||
},
|
||||
"emacs-overlay": {
|
||||
"locked": {
|
||||
"lastModified": 1637515331,
|
||||
"narHash": "sha256-fLfycI+PrBeRaP8CRdlxj3Kkqib+YlPdQIFCUAoj56w=",
|
||||
"lastModified": 1649732714,
|
||||
"narHash": "sha256-D8iDZsLJWXB4n/Iy/KCpgdKSLFff2rynCeohO7Xs3R0=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "86ceb863bc9cca9150666acce49ee2fe50e73cb0",
|
||||
"rev": "8b7323d06cc5310f75781ae87dd50840c3b2bfc7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -199,11 +221,11 @@
|
|||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1627913399,
|
||||
"narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=",
|
||||
"lastModified": 1648199409,
|
||||
"narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2",
|
||||
"rev": "64a525ee38886ab9028e6f61790de0832aa3ef03",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -214,11 +236,11 @@
|
|||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1637014545,
|
||||
"narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=",
|
||||
"lastModified": 1649676176,
|
||||
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4",
|
||||
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -265,11 +287,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1637481586,
|
||||
"narHash": "sha256-cvgegmCRfNFuA/vPseMcSptmlNqD2nC0lLI9BQWU46A=",
|
||||
"lastModified": 1649642044,
|
||||
"narHash": "sha256-V9ZjTJcbDPgWG+H3rIC6XuPHZAPK1VupBbSsuDbptkQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "1abd311eef125e7b64dff723f198d15e5aca2dd4",
|
||||
"rev": "e39a9d0103e3b2e42059c986a8c633824b96c193",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -279,13 +301,34 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixfiles",
|
||||
"nixpkgs-darwin"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1649642044,
|
||||
"narHash": "sha256-V9ZjTJcbDPgWG+H3rIC6XuPHZAPK1VupBbSsuDbptkQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "e39a9d0103e3b2e42059c986a8c633824b96c193",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"impermanence": {
|
||||
"locked": {
|
||||
"lastModified": 1637278200,
|
||||
"narHash": "sha256-nwPBJpjHU8J0hhZ6l4Ytvi3qhcxXJVy4jOWurmzSv3A=",
|
||||
"lastModified": 1646131459,
|
||||
"narHash": "sha256-GPmgxvUFvQ1GmsGfWHy9+rcxWrczeDhS9XnAIPHi9XQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "impermanence",
|
||||
"rev": "0616c64b0ebcf08cc74db7820e74b807274246f6",
|
||||
"rev": "2f39baeb7d039fda5fc8225111bb79474138e6f4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -295,23 +338,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"katexprs": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1637526127,
|
||||
"narHash": "sha256-il4PL9sS1buJ7SSw2SgOloR6+4US92bKJEt1+gJbrOw=",
|
||||
"owner": "kittywitch",
|
||||
"repo": "nixexprs",
|
||||
"rev": "46734151d4071718ca1ff1dda289dbb6ff17d8af",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kittywitch",
|
||||
"ref": "main",
|
||||
"repo": "nixexprs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-dns": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
|
|
@ -397,15 +423,17 @@
|
|||
"anicca": "anicca",
|
||||
"arcexprs": "arcexprs",
|
||||
"ci": "ci",
|
||||
"darwin": "darwin",
|
||||
"emacs-overlay": "emacs-overlay",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"home-manager": "home-manager",
|
||||
"home-manager-darwin": "home-manager-darwin",
|
||||
"impermanence": "impermanence",
|
||||
"katexprs": "katexprs",
|
||||
"nix-dns": "nix-dns",
|
||||
"nix-doom-emacs": "nix-doom-emacs",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-darwin": "nixpkgs-darwin",
|
||||
"nur": "nur",
|
||||
"tf-nix": "tf-nix",
|
||||
"trusted": [
|
||||
|
|
@ -413,22 +441,22 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"narHash": "sha256-iIgsdGTiWzoKHHFU9wXFHzHfFEGpJVEozC7HsByyu2U=",
|
||||
"path": "/nix/store/9gsq8y8c6advmzmh5jbkqdgclc8s1ivs-source",
|
||||
"narHash": "sha256-EsjRXQ9TKNS2EL06nHKg7RmSiOxh7Lh213Eg7JDnj1I=",
|
||||
"path": "/nix/store/dy1mzx66q2x85zzi9lp4vcda62j5k2c8-source",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"path": "/nix/store/9gsq8y8c6advmzmh5jbkqdgclc8s1ivs-source",
|
||||
"path": "/nix/store/dy1mzx66q2x85zzi9lp4vcda62j5k2c8-source",
|
||||
"type": "path"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1637155076,
|
||||
"narHash": "sha256-26ZPNiuzlsnXpt55Q44+yzXvp385aNAfevzVEKbrU5Q=",
|
||||
"lastModified": 1649497218,
|
||||
"narHash": "sha256-groqC9m1P4hpnL6jQvZ3C8NEtduhdkvwGT0+0LUrcYw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "715f63411952c86c8f57ab9e3e3cb866a015b5f2",
|
||||
"rev": "fd364d268852561223a5ada15caad669fd72800e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -438,6 +466,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-darwin": {
|
||||
"locked": {
|
||||
"lastModified": 1649675302,
|
||||
"narHash": "sha256-joXkXjdOn73GF/1Y3mhir44aG5doekJyJwiG3DblIlo=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a31e3437d3b5d8f0b4f3bbc3b097b15b10250dab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-21.11-darwin",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nose": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
@ -456,11 +500,11 @@
|
|||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1637520800,
|
||||
"narHash": "sha256-GjX0uYY/xQcPM8YBDVJgYNNp1plFWwzAQbzBwJ0HX5g=",
|
||||
"lastModified": 1649749110,
|
||||
"narHash": "sha256-gN/BkRu93GDHGENao+G0oHrknSJB3l+sfGOZWkqG2RY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nur",
|
||||
"rev": "fc0758e2f8aa4dac7c4ab42860f07487b1dcadea",
|
||||
"rev": "287aa9ab138e00c3a3519e437a56b7627c62c478",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -607,11 +651,11 @@
|
|||
"tf-nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1637365821,
|
||||
"narHash": "sha256-wtZ8C8KdnLKku4Wu8mmff6lKJ7043YnJAipCRp860X0=",
|
||||
"lastModified": 1649261463,
|
||||
"narHash": "sha256-Sd/lrUeHsDUfIs6xoVsrP9xl98yg7LLxXo+BTJxh/J8=",
|
||||
"owner": "arcnmx",
|
||||
"repo": "tf-nix",
|
||||
"rev": "2e8642b7be0b63807d73a168ea880521de1e83b6",
|
||||
"rev": "c75325133a321904c02e0535d93d0f49cbe81860",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue