initial devOS
This commit is contained in:
parent
5392dea6b1
commit
82abea2237
114
CHANGELOG.md
Normal file
114
CHANGELOG.md
Normal file
|
@ -0,0 +1,114 @@
|
|||
# Changelog
|
||||
|
||||
## [v0.10.0](https://github.com/divnix/devos/tree/v0.10.0) (2021-05-24)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Providing an interface to nixpkgs.config [\#237](https://github.com/divnix/devos/issues/237)
|
||||
- Making the user available in profiles [\#230](https://github.com/divnix/devos/issues/230)
|
||||
- copy evaluation store paths to iso [\#195](https://github.com/divnix/devos/issues/195)
|
||||
- Extract custom system builds from devosSystem out of lib [\#170](https://github.com/divnix/devos/issues/170)
|
||||
- Allow setting of channel host-wide [\#117](https://github.com/divnix/devos/issues/117)
|
||||
- alacritty: CSIu support [\#51](https://github.com/divnix/devos/issues/51)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Cachix timeouts + how to disable nrdxp cachix \(if needed\) [\#294](https://github.com/divnix/devos/issues/294)
|
||||
- default.nix flake-compat is broken [\#285](https://github.com/divnix/devos/issues/285)
|
||||
- All suites return "attribute missing" [\#282](https://github.com/divnix/devos/issues/282)
|
||||
- nix is built two times [\#203](https://github.com/divnix/devos/issues/203)
|
||||
- fix lib docs [\#166](https://github.com/divnix/devos/issues/166)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- eliminate userFlakeNixOS [\#257](https://github.com/divnix/devos/issues/257)
|
||||
- devos-as-library [\#214](https://github.com/divnix/devos/issues/214)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Update evalArgs to match the new planned API [\#239](https://github.com/divnix/devos/pull/239)
|
||||
|
||||
## [v0.9.0](https://github.com/divnix/devos/tree/v0.9.0) (2021-04-19)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- pin inputs into iso live registry [\#190](https://github.com/divnix/devos/issues/190)
|
||||
- Pass 'self' to lib [\#169](https://github.com/divnix/devos/issues/169)
|
||||
- doc: quickstart "ISO. What next?" [\#167](https://github.com/divnix/devos/issues/167)
|
||||
- Integrate Android AOSP putting mobile under control [\#149](https://github.com/divnix/devos/issues/149)
|
||||
- Inoculate host identity on first use [\#132](https://github.com/divnix/devos/issues/132)
|
||||
- kubenix support [\#130](https://github.com/divnix/devos/issues/130)
|
||||
- Improve Home Manager support: profiles/suites, modules, extern, flake outputs [\#119](https://github.com/divnix/devos/issues/119)
|
||||
- Local CA \(between hosts\) [\#104](https://github.com/divnix/devos/issues/104)
|
||||
- Q5: git annex for machine state [\#68](https://github.com/divnix/devos/issues/68)
|
||||
- name space ./pkgs overlays [\#60](https://github.com/divnix/devos/issues/60)
|
||||
- remap global keys easily [\#57](https://github.com/divnix/devos/issues/57)
|
||||
- make pass state part of this repo's structure [\#56](https://github.com/divnix/devos/issues/56)
|
||||
- Incorporate ./shells [\#38](https://github.com/divnix/devos/issues/38)
|
||||
- Encrypt with \(r\)age [\#37](https://github.com/divnix/devos/issues/37)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- `pathsToImportedAttrs` does not accept directories [\#221](https://github.com/divnix/devos/issues/221)
|
||||
- Cachix caches aren't added to the configuration [\#208](https://github.com/divnix/devos/issues/208)
|
||||
- Issues with current changelog workflow [\#205](https://github.com/divnix/devos/issues/205)
|
||||
- iso: systemd service startup [\#194](https://github.com/divnix/devos/issues/194)
|
||||
- Help adding easy-hls-nix to devos [\#174](https://github.com/divnix/devos/issues/174)
|
||||
- `flk update` fails because of obsolete flag [\#159](https://github.com/divnix/devos/issues/159)
|
||||
- Expected that not all packages are exported? [\#151](https://github.com/divnix/devos/issues/151)
|
||||
- Segmentation fault when generating iso [\#150](https://github.com/divnix/devos/issues/150)
|
||||
|
||||
**Documentation:**
|
||||
|
||||
- doc: split iso [\#193](https://github.com/divnix/devos/issues/193)
|
||||
- lib: can depend on pkgs \(a la nixpkgs\#pkgs/pkgs-lib\) [\#147](https://github.com/divnix/devos/pull/147)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- FRRouting router implementation [\#154](https://github.com/divnix/devos/issues/154)
|
||||
- ARM aarch64 Support [\#72](https://github.com/divnix/devos/issues/72)
|
||||
|
||||
## [v0.8.0](https://github.com/divnix/devos/tree/v0.8.0) (2021-03-02)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- semi automatic update for /pkgs [\#118](https://github.com/divnix/devos/issues/118)
|
||||
- Home-manager external modules from flakes [\#106](https://github.com/divnix/devos/issues/106)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- My emacsGcc overlay is not working [\#146](https://github.com/divnix/devos/issues/146)
|
||||
- local flake registry freezes branches [\#142](https://github.com/divnix/devos/issues/142)
|
||||
- nixos-option no longer works after collect garbage [\#138](https://github.com/divnix/devos/issues/138)
|
||||
- Profiles imports are brittle, causing failure if imported twice [\#136](https://github.com/divnix/devos/issues/136)
|
||||
|
||||
## [0.7.0](https://github.com/divnix/devos/tree/0.7.0) (2021-02-20)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- add zoxide [\#53](https://github.com/divnix/devos/issues/53)
|
||||
- Multiarch support? [\#17](https://github.com/divnix/devos/issues/17)
|
||||
- initial multiArch support [\#18](https://github.com/divnix/devos/pull/18)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Missing shebang from flk.sh [\#131](https://github.com/divnix/devos/issues/131)
|
||||
- Rename Meta Issue [\#128](https://github.com/divnix/devos/issues/128)
|
||||
- specialisations break the `system` argument [\#46](https://github.com/divnix/devos/issues/46)
|
||||
- Revert "Add extraArgs to lib.nixosSystem call to add system args." [\#47](https://github.com/divnix/devos/pull/47)
|
||||
|
||||
**Documentation:**
|
||||
|
||||
- update home-manager urls [\#62](https://github.com/divnix/devos/pull/62)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- add github action for cachix build ci [\#59](https://github.com/divnix/devos/issues/59)
|
||||
|
||||
## [12052020](https://github.com/divnix/devos/tree/12052020) (2020-12-06)
|
||||
|
||||
## [07092020](https://github.com/divnix/devos/tree/07092020) (2020-07-09)
|
||||
|
||||
|
||||
|
||||
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
18
COPYING
Normal file
18
COPYING
Normal file
|
@ -0,0 +1,18 @@
|
|||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
91
README.md
Normal file
91
README.md
Normal file
|
@ -0,0 +1,91 @@
|
|||
[![NixOS](https://img.shields.io/badge/NixOS-unstable-blue.svg?style=flat&logo=NixOS&logoColor=white)](https://nixos.org)
|
||||
[![MIT License](https://img.shields.io/github/license/divnix/devos)][mit]
|
||||
[![Chat](https://img.shields.io/matrix/devos:nixos.org.svg?label=%23devos%3Anixos.org&logo=matrix&server_fqdn=matrix.org)][matrix]
|
||||
|
||||
> #### ⚠ Advisory ⚠
|
||||
> DevOS requires the [flakes][flakes] feature available via an _experimental_
|
||||
> branch of [nix][nix]. Until nix 2.4 is released, this project
|
||||
> should be considered unstable.
|
||||
|
||||
### Why?
|
||||
Make an awesome template for NixOS users, with consideration for common tools like [home-manager][home-manager],
|
||||
[devshell][devshell], and [more](./doc/integrations).
|
||||
|
||||
### No. Why _flakes_?
|
||||
Flakes are a part of an explicit push to improve [Nix's UX](https://github.com/NixOS/nix/blob/master/doc/manual/src/contributing/cli-guideline.md), and have become an integral part of that effort.
|
||||
|
||||
They also make [Nix expressions](https://nixos.org/manual/nix/unstable/expressions/expression-syntax.html) easier to distribute and reuse with convient [flake references](https://github.com/NixOS/nix/blob/master/src/nix/flake.md#flake-references) for building or using packages, modules, and whole systems.
|
||||
|
||||
## Getting Started
|
||||
Check out the [guide](https://devos.divnix.com/start) to get up and running.
|
||||
Also, have a look at [_flake.nix_][toc]. If anything is not immediately
|
||||
discoverable via "[`digga`][digga]'s [`mkFlake`][mk-flake],
|
||||
please file a bug report.
|
||||
|
||||
### Status: Beta
|
||||
Although this project has already matured quite a bit, especially through
|
||||
recent outfactoring of [`digga`][digga], a fair amount of api polishing is still
|
||||
expected. There are unstable versions (0._x_._x_) to help users keep track
|
||||
of changes and progress, and a [`develop`](https://github.com/divnix/devos/tree/develop) branch for the brave 😜
|
||||
|
||||
## In the Wild
|
||||
* The original [authors][please]
|
||||
|
||||
## Shoulders
|
||||
This work does not reinvent the wheel. It stands on the [shoulders of the
|
||||
following giants][giants]:
|
||||
|
||||
### :onion: — like the layers of an onion
|
||||
- [`divnix/digga`][digga]
|
||||
- [`gytis-ivaskevicius/flake-utils-plus`][fup]
|
||||
- [`numtide/flake-utils`][fu]
|
||||
|
||||
### :family: — like family
|
||||
- [`numtide/devshell`][devshell]
|
||||
- [`serokell/deploy-rs`][deploy]
|
||||
- [`berberman/nvfetcher`][nvfetcher]
|
||||
- [`NixOS/nixpkgs`][nixpkgs]
|
||||
|
||||
:heart:
|
||||
|
||||
## Inspiration & Art
|
||||
- [hlissner/dotfiles][dotfiles]
|
||||
- [nix-user-chroot](https://github.com/nix-community/nix-user-chroot)
|
||||
- [Nickel](https://github.com/tweag/nickel)
|
||||
- [Awesome Nix](https://github.com/nix-community/awesome-nix)
|
||||
- [devshell](https://github.com/numtide/devshell)
|
||||
|
||||
## Divnix
|
||||
The divnix org is an open space that spontaniously formed out of "the Nix".
|
||||
It is really just a place where otherwise unrelated people a) get
|
||||
together and b) stuff done.
|
||||
|
||||
It's a place to stop "geeking out in isolation" (or within company boundaries),
|
||||
experiment and learn together and iterate quickly on best practices. That's what it is.
|
||||
|
||||
It might eventually become a non-profit if that's not too complicated or if those
|
||||
goals are sufficiently upstreamed into "the Nix", dissolved.
|
||||
|
||||
# License
|
||||
DevOS is licensed under the [MIT License][mit].
|
||||
|
||||
[community]: https://github.com/divnix/devos/tree/community
|
||||
[core]: https://github.com/divnix/devos
|
||||
[deploy]: https://github.com/serokell/deploy-rs
|
||||
[devshell]: https://github.com/numtide/devshell
|
||||
[digga]: https://github.com/divnix/digga
|
||||
[dotfiles]: https://github.com/hlissner/dotfiles
|
||||
[flake-doc]: https://github.com/NixOS/nix/blob/master/src/nix/flake.md
|
||||
[flakes]: https://nixos.wiki/wiki/Flakes
|
||||
[fu]: https://github.com/numtide/flake-utils
|
||||
[fup]: https://github.com/gytis-ivaskevicius/flake-utils-plus
|
||||
[giants]: https://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants
|
||||
[home-manager]: https://nix-community.github.io/home-manager
|
||||
[mit]: https://mit-license.org
|
||||
[mk-flake]: https://github.com/divnix/digga/tree/master/src/mkFlake
|
||||
[nix]: https://nixos.org/manual/nix/stable
|
||||
[nixos]: https://nixos.org/manual/nixos/stable
|
||||
[nixpkgs]: https://github.com/NixOS/nixpkgs
|
||||
[nvfetcher]: https://github.com/berberman/nvfetcher
|
||||
[please]: https://github.com/nrdxp/devos/tree/nrd
|
||||
|
5
bors.toml
Normal file
5
bors.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
status = [ "check" ]
|
||||
|
||||
required_approvals = 1
|
||||
|
||||
up_to_date_approvals = true
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
# Assumes the remote borg backup server has already been initialized
|
||||
# borg init --encryption-key=repokey-blake2 -rsh 'ssh -i /run/keys/id_ed25519_borgbase' 20779@hk-s020.rsync.net:<borg-archive>
|
||||
services.borgbackup.jobs = {
|
||||
backupTaskwarriorRsync = {
|
||||
paths = [ "/var/lib/taskserver" ];
|
||||
doInit = true;
|
||||
repo = "20779@hk-s020.rsync.net:taskwarrior" ;
|
||||
encryption = {
|
||||
mode = "repokey-blake2";
|
||||
passCommand = "cat /run/keys/rsync";
|
||||
};
|
||||
environment = { BORG_RSH = "ssh -i /run/keys/id_ed25519_borgbase"; };
|
||||
compression = "auto,lzma";
|
||||
startAt = "weekly";
|
||||
extraArgs = "--remote-path=borg1";
|
||||
};
|
||||
};
|
||||
services.borgbackup.jobs = {
|
||||
backupShaarliRsync = {
|
||||
paths = [ "/var/www/shaarli-config/data/datastore.php" "/var/www/shaarli-config/config" "/var/www/shaarli-config/.json.config" ];
|
||||
doInit = true;
|
||||
repo = "20779@hk-s020.rsync.net:shaarli" ;
|
||||
encryption = {
|
||||
mode = "repokey-blake2";
|
||||
passCommand = "cat /run/keys/rsync";
|
||||
};
|
||||
environment = { BORG_RSH = "ssh -i /run/keys/id_ed25519_borgbase"; };
|
||||
compression = "auto,lzma";
|
||||
startAt = "weekly";
|
||||
extraArgs = "--remote-path=borg1";
|
||||
};
|
||||
};
|
||||
}
|
29
bowl/box.nix
29
bowl/box.nix
|
@ -1,29 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./common.nix
|
||||
./musician.nix
|
||||
];
|
||||
|
||||
|
||||
users.extraUsers."anish".extraGroups = [ "jackaudio" ];
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
displayManager.gdm.enable = true;
|
||||
desktopManager.gnome3.enable = true;
|
||||
};
|
||||
|
||||
# task whisperer broken
|
||||
#nixpkgs.config.allowBroken = true;
|
||||
|
||||
# virtual box
|
||||
virtualisation.virtualbox.host.enable = true;
|
||||
|
||||
# ErgoDox Firmware (doesn't compile)
|
||||
# environment.systemPackages = with pkgs; [
|
||||
# qmk_firmware
|
||||
# ];
|
||||
}
|
||||
|
115
bowl/common.nix
115
bowl/common.nix
|
@ -1,115 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./nvim.nix
|
||||
# ./unstable.nix
|
||||
];
|
||||
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
htop
|
||||
iftop
|
||||
wget
|
||||
curl
|
||||
exa
|
||||
bat
|
||||
fd
|
||||
ag
|
||||
tcpdump
|
||||
whois
|
||||
mtr
|
||||
file
|
||||
lsof
|
||||
atool
|
||||
inotify-tools
|
||||
strace
|
||||
zip
|
||||
unzip
|
||||
rsync
|
||||
tmux
|
||||
pwgen
|
||||
glow
|
||||
jq
|
||||
gitAndTools.gitFull
|
||||
#neovim defined in ./nvim.nix
|
||||
wofi
|
||||
firefox
|
||||
fractal
|
||||
pinentry_gnome
|
||||
pass
|
||||
gcc
|
||||
less
|
||||
mpv
|
||||
zathura
|
||||
#qmk_firmware
|
||||
python3
|
||||
gdb
|
||||
vcv-rack
|
||||
#xdotool
|
||||
#neofetch
|
||||
#calibre
|
||||
#openvpn
|
||||
gimp
|
||||
xxd
|
||||
tilix
|
||||
kitty
|
||||
taskwarrior
|
||||
gnupg
|
||||
openjdk
|
||||
glslviewer
|
||||
filezilla
|
||||
signal-desktop
|
||||
wire-desktop
|
||||
tdesktop
|
||||
feedreader
|
||||
newsflash
|
||||
syncthing
|
||||
dijo
|
||||
#kdeconnect
|
||||
#ssb-patchwork
|
||||
gnome3.gnome-tweaks
|
||||
gnome3.pomodoro
|
||||
gnomeExtensions.gsconnect
|
||||
#gnomeExtensions.taskwhisperer
|
||||
#gnome3.networkmanager-openvpn
|
||||
#python3Packages.youtube-dl
|
||||
appimage-run
|
||||
home-manager
|
||||
libreoffice
|
||||
fontconfig
|
||||
hugo
|
||||
#processing
|
||||
#nextcloud-client
|
||||
zsh-powerlevel10k
|
||||
powerline-fonts
|
||||
supercollider
|
||||
haskellPackages.tidal
|
||||
# vim-zettel
|
||||
pandoc
|
||||
];
|
||||
|
||||
programs.bash.enableCompletion = true;
|
||||
|
||||
# needed for vcv-rack
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
system.copySystemConfiguration = true;
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
openDefaultPorts = true;
|
||||
systemService = true;
|
||||
user = "anish";
|
||||
dataDir = "/home/anish/usr/syncthing";
|
||||
};
|
||||
|
||||
#zsh powerlevel10k
|
||||
programs.zsh.enable = true;
|
||||
programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
|
||||
users.users.anish.shell = pkgs.zsh;
|
||||
|
||||
#android
|
||||
programs.adb.enable = true;
|
||||
users.users.anish.extraGroups = ["adbusers"];
|
||||
|
||||
}
|
11
bowl/dns.nix
11
bowl/dns.nix
|
@ -1,11 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
services.dnsmasq.enable = false;
|
||||
services.dnsmasq.extraConfig = ''
|
||||
address=/.mossnet.lan/192.168.1.6
|
||||
dhcp-range=192.168.1.1,proxy
|
||||
'';
|
||||
services.dnsmasq.servers = [ "45.90.30.49" "45.90.28.49" "1.1.1.1" "8.8.8.8" ];
|
||||
networking.firewall.allowedTCPPorts = [ 53 ];
|
||||
networking.firewall.allowedUDPPorts = [ 53 ];
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{config, lib, pkgs, ... }:
|
||||
{
|
||||
services.headphones = {
|
||||
enable = true;
|
||||
host = "192.168.1.6";
|
||||
port = 8181;
|
||||
user = "headphones";
|
||||
group = "headphones";
|
||||
dataDir = "/data/downloaded";
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 8181 ];
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
phppoolName = "shaarli";
|
||||
dataDir = "/var/lib/shaarli";
|
||||
vhost = "192.168.1.6:1233";
|
||||
|
||||
shaarli = pkgs.callPackage ./pkg-shaarli.nix {
|
||||
inherit dataDir;
|
||||
};
|
||||
in
|
||||
{
|
||||
services.nginx.virtualHosts."${vhost}" = {
|
||||
forceSSL = false;
|
||||
enableACME = false;
|
||||
root = "${shaarli}";
|
||||
listen = [ { addr = "192.168.1.6"; port = 1233; } ];
|
||||
# extraConfig = ''
|
||||
# index index.php;
|
||||
# '';
|
||||
locations."/" = {
|
||||
index = "index.php";
|
||||
extraConfig = ''
|
||||
try_files $uri $uri/ index.php;
|
||||
'';
|
||||
};
|
||||
locations."~ (index)\.php$" = {
|
||||
extraConfig = ''
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
if (!-f $document_root$fastcgi_script_name) {
|
||||
return 404;
|
||||
}
|
||||
|
||||
include ${pkgs.nginx}/conf/fastcgi.conf;
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools."${phppoolName}".socket};
|
||||
fastcgi_index index.php;
|
||||
'';
|
||||
};
|
||||
locations."~ \.php$" = {
|
||||
extraConfig = ''
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
};
|
||||
services.phpfpm.pools."${phppoolName}" = {
|
||||
user = "nginx";
|
||||
group = "nginx";
|
||||
settings = {
|
||||
"listen.owner" = "nginx";
|
||||
"listen.group" = "nginx";
|
||||
"user" = "nginx";
|
||||
"pm" = "dynamic";
|
||||
"pm.max_children" = "75";
|
||||
"pm.min_spare_servers" = "5";
|
||||
"pm.max_spare_servers" = "20";
|
||||
"pm.max_requests" = "10";
|
||||
"catch_workers_output" = "1";
|
||||
};
|
||||
};
|
||||
users.extraUsers.shaarli = { group = "shaarli"; };
|
||||
users.extraGroups.shaarli = { };
|
||||
systemd.services.shaarli-install = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = ''
|
||||
if [ ! -d "${dataDir}" ]; then
|
||||
mkdir -p ${dataDir}/{cache,data,pagecache,tmp}
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/cache/
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/data/
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/pagecache/
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/tmp/
|
||||
fi
|
||||
chown -Rc nginx:nginx ${dataDir}
|
||||
find ${dataDir} -type d ! -perm 0700 -exec chmod 0700 {} \; -exec chmod g-s {} \;
|
||||
find ${dataDir} -type f ! -perm 0600 -exec chmod 0600 {} \;
|
||||
'';
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 1233 ];
|
||||
}
|
|
@ -1,218 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.wallabag;
|
||||
|
||||
poolName = "wallabag";
|
||||
|
||||
configFile = pkgs.writeTextFile {
|
||||
name = "wallabag-config";
|
||||
text = cfg.conf;
|
||||
destination = "/config/parameters.yml";
|
||||
};
|
||||
|
||||
appDir = pkgs.buildEnv {
|
||||
name = "wallabag-app-dir";
|
||||
ignoreCollisions = true;
|
||||
checkCollisionContents = false;
|
||||
paths = [ configFile "${cfg.package}/app" ];
|
||||
};
|
||||
|
||||
in {
|
||||
options = {
|
||||
services.wallabag = {
|
||||
enable = mkEnableOption "wallabag";
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "nginx";
|
||||
description = ''
|
||||
User account under which both the update daemon and the web-application run.
|
||||
'';
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/wallabag";
|
||||
description = ''
|
||||
Data directory.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.wallabag;
|
||||
description = ''
|
||||
Wallabag package to use.
|
||||
'';
|
||||
};
|
||||
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Name of the nginx virtualhost to use and setup.
|
||||
'';
|
||||
};
|
||||
|
||||
poolConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = ''
|
||||
pm = dynamic
|
||||
pm.max_children = 75
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 20
|
||||
pm.max_requests = 500
|
||||
catch_workers_output = 1
|
||||
'';
|
||||
description = ''
|
||||
Options for wallabag's PHP pool. See the documentation on <literal>php-fpm.conf</literal> for details on configuration directives.
|
||||
'';
|
||||
};
|
||||
|
||||
conf = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Contents of the wallabag configuration file (parameters.yml)
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
services.phpfpm.pools."${poolName}" = {
|
||||
user = "${cfg.user}";
|
||||
group = "nginx";
|
||||
settings = {
|
||||
"listen.owner" = "nginx";
|
||||
"listen.group" = "nginx";
|
||||
"listen.mode" = "0600";
|
||||
"user" = "${cfg.user}";
|
||||
"group" = "nginx";
|
||||
"env[WALLABAG_DATA]" = "${cfg.dataDir}";
|
||||
"pm" = "dynamic";
|
||||
"pm.max_children" = "75";
|
||||
"pm.min_spare_servers" = "5";
|
||||
"pm.max_spare_servers" = "20";
|
||||
"pm.max_requests" = "10";
|
||||
"catch_workers_output" = "1";
|
||||
"php_admin_value[error_log]" = "/var/log/nginx/${poolName}-phpfpm-error.log";
|
||||
};
|
||||
};
|
||||
services.phpfpm.phpOptions = ''
|
||||
max_execution_time = 120
|
||||
'';
|
||||
|
||||
services.nginx.enable = mkDefault true;
|
||||
|
||||
services.nginx.virtualHosts."${cfg.hostName}" = {
|
||||
enableACME = false;
|
||||
forceSSL = false;
|
||||
root = "${cfg.package}/web";
|
||||
|
||||
extraConfig = ''
|
||||
add_header X-Frame-Options SAMEORIGIN;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
'';
|
||||
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
try_files $uri /app.php$is_args$args;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."/assets".root = "${cfg.dataDir}/web";
|
||||
|
||||
locations."~ ^/app\\.php(/|$)" = {
|
||||
extraConfig = ''
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools."${poolName}".socket};
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME ${cfg.package}/web/$fastcgi_script_name;
|
||||
fastcgi_param DOCUMENT_ROOT ${cfg.package}/web;
|
||||
fastcgi_read_timeout 120;
|
||||
|
||||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_param REQUEST_METHOD $request_method;
|
||||
fastcgi_param CONTENT_TYPE $content_type;
|
||||
fastcgi_param CONTENT_LENGTH $content_length;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param DOCUMENT_URI $document_uri;
|
||||
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
||||
|
||||
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
||||
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
||||
|
||||
fastcgi_param REMOTE_ADDR $remote_addr;
|
||||
fastcgi_param REMOTE_PORT $remote_port;
|
||||
fastcgi_param SERVER_ADDR $server_addr;
|
||||
fastcgi_param SERVER_PORT $server_port;
|
||||
fastcgi_param SERVER_NAME $server_name;
|
||||
|
||||
internal;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ /(?!app)\\.php$" = {
|
||||
extraConfig = ''
|
||||
return 404;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.wallabag-install = {
|
||||
description = "Wallabag install service";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "phpfpm-wallabag.service" ];
|
||||
after = [ "mysql.service" "postgresql.service" ];
|
||||
path = with pkgs; [ coreutils php phpPackages.composer ];
|
||||
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = "yes";
|
||||
PermissionsStartOnly = true;
|
||||
};
|
||||
|
||||
preStart = ''
|
||||
mkdir -p "${cfg.dataDir}"
|
||||
chown ${cfg.user}:nginx "${cfg.dataDir}"
|
||||
'';
|
||||
|
||||
script = ''
|
||||
echo "Setting up wallabag files in ${cfg.dataDir} ..."
|
||||
cd "${cfg.dataDir}"
|
||||
|
||||
rm -rf var/cache/*
|
||||
rm -f app
|
||||
ln -sf ${appDir} app
|
||||
ln -sf ${cfg.package}/composer.{json,lock} .
|
||||
|
||||
export WALLABAG_DATA="${cfg.dataDir}"
|
||||
if [ ! -f installed ]; then
|
||||
php ${cfg.package}/bin/console --env=prod doctrine:database:create --if-not-exists --no-interaction
|
||||
php ${cfg.package}/bin/console --env=prod doctrine:migrations:migrate --no-interaction
|
||||
# Until https://github.com/wallabag/wallabag/issues/3662 is fixed
|
||||
# yes no | php ${cfg.package}/bin/console --env=prod wallabag:install
|
||||
touch installed
|
||||
else
|
||||
php ${cfg.package}/bin/console --env=prod doctrine:migrations:migrate --no-interaction
|
||||
fi
|
||||
php ${cfg.package}/bin/console --env=prod cache:clear
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
maintainers = with maintainers; [ nadrieril ];
|
||||
};
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
{ config, pkgs, ... }: {
|
||||
# grafana configuration
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
domain = "grafana.mossnet.lan";
|
||||
port = 2342;
|
||||
addr = "127.0.0.1";
|
||||
};
|
||||
|
||||
# nginx reverse proxy
|
||||
services.nginx.virtualHosts.${config.services.grafana.domain} = {
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
port = 9001;
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [ "systemd" ];
|
||||
port = 9002;
|
||||
};
|
||||
};
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "bowl";
|
||||
static_configs = [{
|
||||
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
services.loki = {
|
||||
enable = true;
|
||||
configFile = /var/loki-config.yaml;
|
||||
};
|
||||
|
||||
systemd.services.promtail = {
|
||||
description = "Promtail service for Loki";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.grafana-loki}/bin/promtail --config.file ${/var/promtail.yaml}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
{pkgs, config, ... }:
|
||||
{
|
||||
imports = [
|
||||
/home/anish/usr/musnix
|
||||
];
|
||||
|
||||
musnix.enable = true;
|
||||
users.users.anish.extraGroups = [ "audio" ];
|
||||
|
||||
environment.systemPackages = with pkgs; [ ardour patchage helm ];
|
||||
#services.jack = {
|
||||
# jackd.enable = true;
|
||||
# # support ALSA only programs via ALSA JACK PCM plugin
|
||||
# alsa.enable = false;
|
||||
# # support ALSA only programs via loopback device (supports programs like Steam)
|
||||
# loopback = {
|
||||
# enable = true;
|
||||
# # buffering parameters for dmix device to work with ALSA only semi-professional sound programs
|
||||
# #dmixConfig = ''
|
||||
# # period_size 2048
|
||||
# #'';
|
||||
# };
|
||||
#};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
imports = [ <musnix> ];
|
||||
musnix.enable = true;
|
||||
|
||||
users.users."anish".extraGroups = [ "audio" ];
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.navidrome;
|
||||
configFile = "/etc/navidrome/settings.json";
|
||||
dataFolder = "/var/lib/navidrome";
|
||||
in {
|
||||
options = {
|
||||
|
||||
services.navidrome = {
|
||||
enable = mkEnableOption "Navidrome music server and streamer";
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = with types; attrsOf (oneOf [ int str ]);
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
LogLevel = "INFO";
|
||||
BaseURL = "/music";
|
||||
ScanInterval = "10s";
|
||||
TranscodingCacheSize = "15MB";
|
||||
MusicFolder = "/data/music";
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Configuration for Navidrome, see <link xlink:href="https://www.navidrome.org/docs/usage/configuration-options/"/> for supported values.
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "navidrome";
|
||||
description = "User account under which Navidrome runs.";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "navidrome";
|
||||
description = "Group account under which Navidrome runs.";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.etc."navidrome/settings.json".text = builtins.toJSON cfg.settings;
|
||||
|
||||
services.navidrome.settings = {
|
||||
DataFolder = dataFolder;
|
||||
ConfigFile = configFile;
|
||||
};
|
||||
|
||||
systemd.services.navidrome = {
|
||||
description = "Navidrome Music Server and Streamer compatible with Subsonic/Airsonic";
|
||||
after = [ "remote-fs.target" "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment = {
|
||||
ND_CONFIGFILE = configFile;
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.navidrome}/bin/navidrome";
|
||||
WorkingDirectory = dataFolder;
|
||||
TimeoutStopSec = "20";
|
||||
KillMode = "process";
|
||||
Restart = "on-failure";
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
DevicePolicy = "closed";
|
||||
NoNewPrivileges= " yes";
|
||||
PrivateTmp = "yes";
|
||||
PrivateUsers = "yes";
|
||||
ProtectControlGroups = "yes";
|
||||
ProtectKernelModules = "yes";
|
||||
ProtectKernelTunables = "yes";
|
||||
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
|
||||
RestrictNamespaces = "yes";
|
||||
RestrictRealtime = "yes";
|
||||
SystemCallFilter = "~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap";
|
||||
ReadWritePaths = dataFolder;
|
||||
StateDirectory = baseNameOf dataFolder;
|
||||
};
|
||||
};
|
||||
|
||||
users.users = optionalAttrs (cfg.user == "navidrome") ({
|
||||
navidrome = {
|
||||
description = "Navidrome service user";
|
||||
name = cfg.user;
|
||||
group = cfg.group;
|
||||
isSystemUser = true;
|
||||
};
|
||||
});
|
||||
|
||||
users.groups = optionalAttrs (cfg.group == "navidrome") ({
|
||||
navidrome = {};
|
||||
});
|
||||
|
||||
};
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
#networking.interfaces.enp3s0.ipv4.addresses = [ {
|
||||
#address = "192.168.1.6";
|
||||
#prefixLength = 24;
|
||||
#} ];
|
||||
networking.nameservers = [ "1.1.1.1" ];
|
||||
#networking.defaultGateway = "192.168.1.1";
|
||||
environment.systemPackages = [ pkgs.mosh ];
|
||||
programs.mosh.enable = true;
|
||||
#config.nssDatabase.hosts = [ "mdns_minimal" "[NOTFOUND=return]" ];
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
{ pkgs, config, ... }:
|
||||
{
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
hostName = "mossnet.lan";
|
||||
#home = "/data/nextcloud";
|
||||
|
||||
# Use HTTPS for links
|
||||
https = false;
|
||||
|
||||
# Auto-update Nextcloud Apps
|
||||
autoUpdateApps.enable = true;
|
||||
# Set what time makes sense for you
|
||||
autoUpdateApps.startAt = "05:00:00";
|
||||
|
||||
config = {
|
||||
# Further forces Nextcloud to use HTTPS
|
||||
# overwriteProtocol = "https";
|
||||
|
||||
# Nextcloud PostegreSQL database configuration, recommended over using SQLite
|
||||
dbtype = "pgsql";
|
||||
dbuser = "nextcloud";
|
||||
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
|
||||
dbname = "nextcloud";
|
||||
dbpassFile = "/var/nextcloud-db-pass";
|
||||
|
||||
adminpassFile = "/var/nextcloud-admin-pass";
|
||||
adminuser = "admin";
|
||||
};
|
||||
};
|
||||
|
||||
# Enable PostgreSQL
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
|
||||
# Ensure the database, user, and permissions always exist
|
||||
ensureDatabases = [ "nextcloud" ];
|
||||
ensureUsers = [
|
||||
{ name = "nextcloud";
|
||||
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Ensure that postgres is running before running the setup
|
||||
systemd.services."nextcloud-setup" = {
|
||||
requires = ["postgresql.service"];
|
||||
after = ["postgresql.service"];
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{ pkgs, config, ... }:
|
||||
{
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
# Replace the email here!
|
||||
email = "anish@lakhwara.com";
|
||||
};
|
||||
}
|
262
bowl/nvim.nix
262
bowl/nvim.nix
|
@ -1,262 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
|
||||
#nvim
|
||||
{
|
||||
environment.variables.EDITOR = "nvim";
|
||||
environment.shellAliases = {
|
||||
k = "vim -c :VimwikiIndex";
|
||||
kz = "vim -c :VimwikiIndex -c :ZettelNew";
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
nodejs
|
||||
( neovim.override {
|
||||
vimAlias = true;
|
||||
configure = {
|
||||
packages.myPlugins = with pkgs.vimPlugins; {
|
||||
start = [
|
||||
vim-nix
|
||||
fzf-vim
|
||||
vim-elixir
|
||||
emmet-vim
|
||||
nerdtree
|
||||
goyo-vim
|
||||
vim-sneak
|
||||
lightline-vim
|
||||
csv-vim
|
||||
vimwiki
|
||||
coc-nvim
|
||||
coc-json
|
||||
coc-python
|
||||
coc-pairs
|
||||
coc-emmet
|
||||
emmet-vim
|
||||
LanguageClient-neovim
|
||||
ayu-vim
|
||||
rainbow_parentheses-vim
|
||||
vim-surround
|
||||
vim-fugitive
|
||||
#iron-nvim
|
||||
#nvim-colorizer
|
||||
vim-devicons
|
||||
|
||||
# testing
|
||||
#vim-processing
|
||||
#vim-tidal
|
||||
taskwiki
|
||||
vim-zettel
|
||||
vimwiki-sync
|
||||
];
|
||||
};
|
||||
customRC = ''
|
||||
set tabstop=2
|
||||
set showmatch
|
||||
set shiftwidth=2
|
||||
set noexpandtab
|
||||
set autoindent
|
||||
|
||||
set foldmethod=indent " fold based on indent
|
||||
set number
|
||||
set nocompatible
|
||||
set relativenumber
|
||||
set showtabline=2
|
||||
set autowriteall
|
||||
syntax on
|
||||
set list lcs=tab:\|\
|
||||
filetype plugin on
|
||||
|
||||
set termguicolors
|
||||
let ayucolor="dark"
|
||||
colorscheme ayu
|
||||
|
||||
" window
|
||||
nmap <leader>wh :topleft vnew<CR>
|
||||
nmap <leader>wl :botright vnew<CR>
|
||||
nmap <leader>wk :topleft new<CR>
|
||||
nmap <leader>wj :botright new<CR>
|
||||
|
||||
let mapleader = "\<Space>"
|
||||
|
||||
" lightline colorscheme
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'seoul256',
|
||||
\ }
|
||||
|
||||
" moving splits with vim movements.
|
||||
:tnoremap <A-h> <C-\><C-N><C-w>h
|
||||
:tnoremap <A-j> <C-\><C-N><C-w>j
|
||||
:tnoremap <A-k> <C-\><C-N><C-w>k
|
||||
:tnoremap <A-l> <C-\><C-N><C-w>l
|
||||
:inoremap <A-h> <C-\><C-N><C-w>h
|
||||
:inoremap <A-j> <C-\><C-N><C-w>j
|
||||
:inoremap <A-k> <C-\><C-N><C-w>k
|
||||
:inoremap <A-l> <C-\><C-N><C-w>l
|
||||
:nnoremap <A-h> <leader>h
|
||||
:nnoremap <A-j> <leader>j
|
||||
:nnoremap <A-k> <leader>k
|
||||
:nnoremap <A-l> <leader>l
|
||||
:nnoremap <F5> "=strftime("%Y-%m-%d %H:%M:")
|
||||
:inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M:")
|
||||
|
||||
" exit normal mode in terminal
|
||||
:tnoremap <C-n> <C-\><C-n>
|
||||
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
let g:syntastic_auto_loc_list = 1
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
|
||||
let g:rainbow_active = 0
|
||||
autocmd BufReadPost,BufNewFile c,py,nix RainbowParenthesesToggleAll
|
||||
|
||||
" keyboard commands
|
||||
map <leader>t :NERDTreeToggle<CR>
|
||||
map <leader>s :w<CR>
|
||||
map <leader>q :wq<CR>
|
||||
map <leader>r :RainbowParenthesesToggleAll<CR>
|
||||
map <leader>zs :ZettelSearch<CR>
|
||||
map <leader>zo :ZettelOpen<CR>
|
||||
map <leader>zn :ZettelNew<CR>
|
||||
|
||||
|
||||
" NERDTree
|
||||
" open on directory
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
|
||||
" coc
|
||||
"
|
||||
" if hidden is not set, TextEdit might fail.
|
||||
set hidden
|
||||
|
||||
" Some servers have issues with backup files, see #649
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
|
||||
" Better display for messages
|
||||
set cmdheight=2
|
||||
|
||||
" You will have bad experience for diagnostic messages when it's default 4000.
|
||||
set updatetime=300
|
||||
|
||||
" don't give |ins-completion-menu| messages.
|
||||
set shortmess+=c
|
||||
|
||||
" always show signcolumns
|
||||
set signcolumn=yes
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
|
||||
" Coc only does snippet and additional edit on confirm.
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
" Or use `complete_info` if your vim support it, like:
|
||||
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" Remap keys for gotos
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Use K to show documentation in preview window
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight symbol under cursor on CursorHold
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Remap for rename current word
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Remap for format selected region
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
|
||||
augroup mygroup
|
||||
autocmd!
|
||||
" Setup formatexpr specified filetype(s).
|
||||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||
" Update signature help on jump placeholder
|
||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||
augroup end
|
||||
|
||||
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
|
||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap for do codeAction of current line
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Fix autofix problem of current line
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
" Create mappings for function text object, requires document symbols feature of languageserver.
|
||||
xmap if <Plug>(coc-funcobj-i)
|
||||
xmap af <Plug>(coc-funcobj-a)
|
||||
omap if <Plug>(coc-funcobj-i)
|
||||
omap af <Plug>(coc-funcobj-a)
|
||||
|
||||
" Use <C-d> for select selections ranges, needs server support, like: coc-tsserver, coc-python
|
||||
nmap <silent> <C-d> <Plug>(coc-range-select)
|
||||
xmap <silent> <C-d> <Plug>(coc-range-select)
|
||||
|
||||
" Use `:Format` to format current buffer
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
|
||||
" Use `:Fold` to fold current buffer
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" use `:OR` for organize import of current buffer
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Add status line support, for integration with other plugin, checkout `:h coc-status`
|
||||
" set statusline^=%{coc#status()}%{get(b:,'coc_current_function',"")}
|
||||
|
||||
" Using CocList
|
||||
" Show all diagnostics
|
||||
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions
|
||||
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands
|
||||
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document
|
||||
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols
|
||||
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item.
|
||||
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item.
|
||||
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list
|
||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||
|
||||
au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl
|
||||
'';
|
||||
};
|
||||
}
|
||||
)];
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.navidrome.enable = true;
|
||||
services.navidrome.settings = {
|
||||
MusicFolder = "/data/music";
|
||||
Port = 4433;
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 4433 ];
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
{ lib, stdenv, fetchurl, config ? null, dataDir ? "/var/lib/shaarli" }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "rssBridge-${version}";
|
||||
version = "2020-10-11";
|
||||
preferLocalBuild = true;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/RSS-Bridge/rss-bridge/archive/${version}.tar.gz";
|
||||
sha256 = "";
|
||||
};
|
||||
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
tar xzf $src
|
||||
cp -ra * $out/
|
||||
find $out -type d -exec chmod 0755 {} \;
|
||||
find $out -type f -exec chmod 0644 {} \;
|
||||
ln -s $dataDir $out
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "RSS-Bridge is a project to create RSS Feeds for websites that don't have one.";
|
||||
#license = licenses.agpl3;
|
||||
homepage = "https://github.com/RSS-Bridge/rss-bridge/";
|
||||
platforms = platforms.all;
|
||||
maintainers = with stdenv.lib.maintainers; [ chickensoupwithrice ];
|
||||
};
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
{ lib, stdenv, fetchurl, config ? null, dataDir ? "/var/lib/shaarli" }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "shaarli-${version}";
|
||||
version = "0.11.1";
|
||||
preferLocalBuild = true;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/shaarli/Shaarli/releases/download/v0.11.1/shaarli-v${version}-full.tar.gz";
|
||||
sha256 = "1psijcmi24hk0gxh1zdsm299xj11i7find2045nnx3r96cgnwjpn";
|
||||
};
|
||||
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
tar xzf $src
|
||||
cp -ra Shaarli/. $out/
|
||||
find $out -type d -exec chmod 0755 {} \;
|
||||
find $out -type f -exec chmod 0644 {} \;
|
||||
for a in cache data pagecache tmp; do
|
||||
mv $out/$a $out/$a.orig
|
||||
ln -s "${dataDir}/$a" $out/$a
|
||||
done
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "";
|
||||
# License is complicated...
|
||||
#license = licenses.agpl3;
|
||||
homepage = "https://github.com/shaarli/Shaarli";
|
||||
platforms = platforms.all;
|
||||
maintainers = with stdenv.lib.maintainers; [ tokudan ];
|
||||
};
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
{ stdenv, fetchurl }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "wallabag";
|
||||
version = "2.4.0";
|
||||
|
||||
# remember to rm -r var/cache/* after a rebuild or unexpected errors will occur
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://static.wallabag.org/releases/wallabag-release-${version}.tar.gz";
|
||||
sha256 = "11vda7aqq82kpr88v4hr7zg19zfq970n3z4qp25my8b1fvlgdjhi";
|
||||
};
|
||||
|
||||
outputs = [ "out" ];
|
||||
|
||||
patches = [
|
||||
./wallabag-data.patch # exposes $WALLABAG_DATA
|
||||
];
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir $out/
|
||||
cp -R * $out/
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Web page archiver";
|
||||
longDescription = ''
|
||||
wallabag is a self hostable application for saving web pages.
|
||||
Point the environment variable $WALLABAG_DATA to a data directory that contains the folder `app/config` which must be a clone of wallabag's configuration files with your customized `parameters.yml`. These need to be updated every package upgrade.
|
||||
After a package upgrade, empty the `var/cache` folder.
|
||||
'';
|
||||
license = licenses.mit;
|
||||
homepage = "http://wallabag.org";
|
||||
maintainers = with maintainers; [ schneefux ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
app = "shaarli";
|
||||
dataDir = "/var/www/${app}";
|
||||
in {
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
"192.168.1.6:1232" = {
|
||||
forceSSL = false;
|
||||
enableACME = false;
|
||||
#root = pkgs.shaarli;
|
||||
root = dataDir;
|
||||
listen = [ { addr = "192.168.1.6"; port = 1232; } ];
|
||||
extraConfig = ''
|
||||
index index.php;
|
||||
'';
|
||||
locations = {
|
||||
"/".index = "index.php";
|
||||
|
||||
"~ /\\.".extraConfig = ''
|
||||
log_not_found off;
|
||||
deny all;
|
||||
'';
|
||||
|
||||
"~ (index)\\.php$".extraConfig = ''
|
||||
try_files $uri =404
|
||||
include ${pkgs.nginx}/conf/fastcgi.conf;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SHAARLI_CONFIG /var/www/shaarli/config;
|
||||
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools.${app}.socket};
|
||||
fastcgi_index index.php;
|
||||
'';
|
||||
|
||||
"^~ /tpl/".extraConfig = "alias ${pkgs.shaarli}/tpl/;";
|
||||
|
||||
"~ \\.php$".extraConfig = ''
|
||||
deny all;
|
||||
'';
|
||||
|
||||
"^~ /plugins/".extraConfig = "alias ${pkgs.shaarli}/plugins/;";
|
||||
|
||||
"~* \\.(?:ico|css|js|gif|jpe?g|png)$".extraConfig = ''
|
||||
expires max;
|
||||
add_header Pragma public;
|
||||
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
services.phpfpm.pools.${app} = {
|
||||
user = app;
|
||||
#listen = "/run/phpfpm/shaarli.sock";
|
||||
settings = {
|
||||
"listen.owner" = config.services.nginx.user;
|
||||
"pm" = "dynamic";
|
||||
"pm.max_children" = 4;
|
||||
"pm.start_servers" = 2;
|
||||
"pm.min_spare_servers" = 1;
|
||||
"pm.max_spare_servers" = 4;
|
||||
"pm.max_requests" = 32;
|
||||
"php_admin_value[error_log]" = "stderr";
|
||||
"php_admin_flag[log_errors]" = true;
|
||||
};
|
||||
};
|
||||
systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/www" ];
|
||||
users.users.${app} = {
|
||||
isSystemUser = true;
|
||||
createHome = true;
|
||||
home = dataDir;
|
||||
group = app;
|
||||
};
|
||||
users.groups.${app} = {};
|
||||
networking.firewall.allowedTCPPorts = [ 1232 ];
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{ pkg, config, lib, ... }:
|
||||
{
|
||||
docker-containers."shaarli" = {
|
||||
image = "shaarli/shaarli";
|
||||
volumes = [ "shaarli:/var/lib/shaarli/data/" ];
|
||||
ports = [ "1233:80" ];
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 1233 ];
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
phppoolName = "shaarli";
|
||||
dataDir = "/var/lib/shaarli";
|
||||
vhost = "192.168.1.6:1232";
|
||||
|
||||
shaarli = pkgs.callPackage ./pkg-shaarli.nix {
|
||||
inherit dataDir;
|
||||
};
|
||||
in
|
||||
{
|
||||
services.nginx.virtualHosts."${vhost}" = {
|
||||
forceSSL = false;
|
||||
enableACME = false;
|
||||
root = "${dataDir}";
|
||||
listen = [ { addr = "192.168.1.6"; port = 1232; } ];
|
||||
extraConfig = ''
|
||||
index index.php;
|
||||
'';
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
try_files _ /index.php$is_args$args;";
|
||||
'';
|
||||
};
|
||||
locations."~ (index)\\.php$" = {
|
||||
extraConfig = ''
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
if (!-f $document_root$fastcgi_script_name) {
|
||||
return 404;
|
||||
}
|
||||
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools.shaarli.socket};
|
||||
fastcgi_index index.php;
|
||||
|
||||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_param REQUEST_METHOD $request_method;
|
||||
fastcgi_param CONTENT_TYPE $content_type;
|
||||
fastcgi_param CONTENT_LENGTH $content_length;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param DOCUMENT_URI $document_uri;
|
||||
fastcgi_param DOCUMENT_ROOT $document_root;
|
||||
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
||||
|
||||
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
||||
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
||||
|
||||
fastcgi_param REMOTE_ADDR $remote_addr;
|
||||
fastcgi_param REMOTE_PORT $remote_port;
|
||||
fastcgi_param SERVER_ADDR $server_addr;
|
||||
fastcgi_param SERVER_PORT $server_port;
|
||||
fastcgi_param SERVER_NAME $server_name;
|
||||
|
||||
fastcgi_param HTTPS $https;
|
||||
'';
|
||||
};
|
||||
};
|
||||
services.phpfpm.pools.shaarli = {
|
||||
user = "shaarli";
|
||||
group = "shaarli";
|
||||
settings = {
|
||||
"listen.owner" = "nginx";
|
||||
"listen.group" = "nginx";
|
||||
"user" = "shaarli";
|
||||
"pm" = "dynamic";
|
||||
"pm.max_children" = "75";
|
||||
"pm.min_spare_servers" = "5";
|
||||
"pm.max_spare_servers" = "20";
|
||||
"pm.max_requests" = "10";
|
||||
"catch_workers_output" = "1";
|
||||
};
|
||||
};
|
||||
users.extraUsers.shaarli = { group = "shaarli"; home = dataDir; };
|
||||
users.extraGroups.shaarli = { };
|
||||
systemd.services.shaarli-install = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = ''
|
||||
if [ ! -d "${dataDir}" ]; then
|
||||
mkdir -p ${dataDir}/{cache,data,pagecache,tmp}
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/cache/
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/data/
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/pagecache/
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/tmp/
|
||||
fi
|
||||
chown -Rc shaarli:shaarli ${dataDir}
|
||||
find ${dataDir} -type d ! -perm 0700 -exec chmod 0700 {} \; -exec chmod g-s {} \;
|
||||
find ${dataDir} -type f ! -perm 0600 -exec chmod 0600 {} \;
|
||||
'';
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 1232 ];
|
||||
}
|
116
bowl/shaarli.nix
116
bowl/shaarli.nix
|
@ -1,116 +0,0 @@
|
|||
{ pkgs, config, ... }:
|
||||
let
|
||||
dataDir = "/var/www/shaarli-config";
|
||||
name = "shaarli";
|
||||
in
|
||||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
"links.mossnet.lan" = {
|
||||
forceSSL = false;
|
||||
enableACME = false;
|
||||
root = "${dataDir}";
|
||||
#listen = [ { addr = "192.168.1.6"; port = 1234; } ];
|
||||
extraConfig = ''
|
||||
index index.php;
|
||||
'';
|
||||
locations = {
|
||||
"/".extraConfig = ''
|
||||
try_files $uri $uri/ index.php;
|
||||
'';
|
||||
|
||||
"~ (index)\.php$".extraConfig = ''
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
if (!-f $document_root$fastcgi_script_name) {
|
||||
return 404;
|
||||
}
|
||||
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools."${name}".socket};
|
||||
fastcgi_index index.php;
|
||||
|
||||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_param REQUEST_METHOD $request_method;
|
||||
fastcgi_param CONTENT_TYPE $content_type;
|
||||
fastcgi_param CONTENT_LENGTH $content_length;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param DOCUMENT_URI $document_uri;
|
||||
fastcgi_param DOCUMENT_ROOT $document_root;
|
||||
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
||||
|
||||
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
||||
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
||||
|
||||
fastcgi_param REMOTE_ADDR $remote_addr;
|
||||
fastcgi_param REMOTE_PORT $remote_port;
|
||||
fastcgi_param SERVER_ADDR $server_addr;
|
||||
fastcgi_param SERVER_PORT $server_port;
|
||||
fastcgi_param SERVER_NAME $server_name;
|
||||
'';
|
||||
|
||||
"~ \.php$".extraConfig = ''
|
||||
deny all;
|
||||
'';
|
||||
|
||||
"^~ /tpl/".extraConfig = "alias ${pkgs.shaarli}/tpl/;";
|
||||
|
||||
"^~ /plugins/".extraConfig = "alias ${pkgs.shaarli}/plugins/;";
|
||||
|
||||
"~* \\.(?:ico|css|js|gif|jpe?g|png)$".extraConfig = ''
|
||||
expires max;
|
||||
add_header Pragma public;
|
||||
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.phpfpm = {
|
||||
pools = {
|
||||
"${name}" = {
|
||||
user = "nginx";
|
||||
group = "nginx";
|
||||
#listen = "/run/phpfpm/php.sock";
|
||||
settings = {
|
||||
"listen.owner" = "nginx";
|
||||
"listen.group" = "nginx";
|
||||
"user" = "nginx";
|
||||
"pm" = "dynamic";
|
||||
"pm.max_children" = "4";
|
||||
"pm.min_spare_servers" = "1";
|
||||
"pm.max_spare_servers" = "4";
|
||||
"pm.max_requests" = "32";
|
||||
"catch_workers_output" = "1";
|
||||
"php_admin_value[error_log]" = "/var/log/nginx/${name}-phpfpm-error.log";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
users.extraUsers."${name}" = { group = "${name}"; };
|
||||
users.extraGroups."${name}" = { };
|
||||
systemd.services.shaarli-install = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = ''
|
||||
if [ ! -d "${dataDir}" ]; then
|
||||
mkdir -p ${dataDir}/{cache,data,pagecache,tmp}
|
||||
cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/cache/
|
||||
cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/data/
|
||||
cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/pagecache/
|
||||
cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/tmp/
|
||||
ln -S ${pkgs.shaarli}/* ${dataDir}
|
||||
fi
|
||||
chown -Rc nginx:nginx ${dataDir}
|
||||
find ${dataDir} -type d ! -perm 0700 -exec chmod 0700 {} \; -exec chmod g-s {} \;
|
||||
find ${dataDir} -type f ! -perm 0600 -exec chmod 0600 {} \;
|
||||
'';
|
||||
};
|
||||
# TODO: Write the configuration file here?
|
||||
#networking.firewall.allowedTCPPorts = [ 1234 ];
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{
|
||||
services.shiori.enable = true;
|
||||
services.shiori.address = "192.168.1.6";
|
||||
services.shiori.port = 1234;
|
||||
networking.firewall.allowedTCPPorts = [ 1234 ];
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.taskserver.enable = true;
|
||||
#services.taskserver.fqdn = "192.168.1.6";
|
||||
#services.taskserver.listenHost = "192.168.1.6";
|
||||
services.taskserver.fqdn = "172.16.11.242";
|
||||
services.taskserver.listenHost = "172.16.11.242";
|
||||
services.taskserver.listenPort = 53589;
|
||||
services.taskserver.organisations.mossnet.users = [ "anish" ];
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.taskserver.enable = true;
|
||||
services.taskserver.fqdn = "bowl";
|
||||
services.taskserver.listenHost = "::";
|
||||
services.taskserver.organisations.mossnet.users = [ "anish" ];
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
|
||||
let
|
||||
vhost = "192.168.1.6:1232";
|
||||
in
|
||||
{
|
||||
services.nginx.virtualHosts."${vhost}" = {
|
||||
forceSSL = false;
|
||||
enableACME = false;
|
||||
root = "/var/lib/test";
|
||||
listen = [ { addr = "192.168.1.6"; port = 1232; } ];
|
||||
extraConfig = ''
|
||||
index index.html;
|
||||
'';
|
||||
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
try_files $uri $uri/ index.html;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 1232 ];
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
|
||||
let
|
||||
unstable = import <nixos-unstable> {};
|
||||
in {
|
||||
nix.nixPath = [
|
||||
"nixos-unstable=https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz"
|
||||
];
|
||||
|
||||
#currently installed this software through nix-env -f https://nixos.org/channels/nixos-unstable -iA [ packages ]
|
||||
environment.systemPackages = [ unstable.ripcord ];
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
diff --git a/app/AppKernel.php b/app/AppKernel.php
|
||||
index 347197e..902b558 100644
|
||||
--- a/app/AppKernel.php
|
||||
+++ b/app/AppKernel.php
|
||||
@@ -69,19 +69,24 @@ class AppKernel extends Kernel
|
||||
return __DIR__;
|
||||
}
|
||||
|
||||
+ public function getProjectDir()
|
||||
+ {
|
||||
+ return getenv('WALLABAG_DATA') ?: dirname(__DIR__);
|
||||
+ }
|
||||
+
|
||||
public function getCacheDir()
|
||||
{
|
||||
- return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
|
||||
+ return $this->getProjectDir() . '/var/cache/' . $this->getEnvironment();
|
||||
}
|
||||
|
||||
public function getLogDir()
|
||||
{
|
||||
- return dirname(__DIR__) . '/var/logs';
|
||||
+ return $this->getProjectDir() . '/var/logs';
|
||||
}
|
||||
|
||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
||||
{
|
||||
- $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
|
||||
+ $loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml');
|
||||
|
||||
$loader->load(function ($container) {
|
|
@ -1,52 +0,0 @@
|
|||
{ pkg, config, lib, ... }:
|
||||
{
|
||||
docker-containers."wallabag-db" = {
|
||||
image = "postgres";
|
||||
environment = {
|
||||
"POSTGRES_PASSWORD" = "wallaroot";
|
||||
"POSTGRES_USER" = "postgres";
|
||||
};
|
||||
extraDockerOptions = [ "--network=wallabag-br" ];
|
||||
volumes = [ "/opt/wallabag/data:/var/www/wallabag" ];
|
||||
};
|
||||
|
||||
docker-containers."wallabag" = {
|
||||
image = "wallabag/wallabag";
|
||||
ports = [ "800:80" ];
|
||||
#volumes = [ "/opt/wallabag/data:/var/www/wallabag/data" "/opt/wallabag/images:/var/www/wallabag/web/assets/images" ];
|
||||
environment = {
|
||||
"SYMFONY__ENV__DOMAIN_NAME" = "http://192.168.1.6:800";
|
||||
"POSTGRES_PASSWORD" = "wallaroot";
|
||||
"POSTGRES_USER" = "postgres";
|
||||
"SYMFONY__ENV__DATABASE_DRIVER" = "pdo_pgsql";
|
||||
"SYMFONY__ENV__DATABASE_DRIVER_CLASS" = "Wallabag\\CoreBundle\\Doctrine\\DBAL\\Driver\\CustomPostgreSQLDriver";
|
||||
"SYMFONY__ENV__DATABASE_HOST" = "wallabag-db";
|
||||
"SYMFONY__ENV__DATABASE_PORT" = "5432";
|
||||
"SYMFONY__ENV__DATABASE_NAME" = "wallabag";
|
||||
"SYMFONY__ENV__DATABASE_USER" = "wallabag";
|
||||
"SYMFONY__ENV__DATABASE_PASSWORD" = "wallapass";
|
||||
#"SYMFONY__ENV__DATABASE_CHARSET" = "utf8mb4";
|
||||
};
|
||||
extraDockerOptions = [ "--network=wallabag-br" ];
|
||||
};
|
||||
|
||||
systemd.services.init-wallabag-docker-br = {
|
||||
description = "Create the network bridge wallabag.";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = let dockercli = "${config.virtualisation.docker.package}/bin/docker";
|
||||
in ''
|
||||
# Put a true at the end to prevent getting non-zero return code, which will
|
||||
# crash the whole service.
|
||||
check=$(${dockercli} network ls | grep "wallabag-br" || true)
|
||||
if [ -z "$check" ]; then
|
||||
${dockercli} network create wallabag-br
|
||||
else
|
||||
echo "wallabag-br already exists in docker"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 800 ];
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
|
||||
{
|
||||
|
||||
services.wallabag = {
|
||||
enable = true;
|
||||
hostName = "read.mossnet.lan";
|
||||
package = pkgs.callPackage ./pkg-wallabag.nix {};
|
||||
conf = ''
|
||||
# This file is a "template" of what your parameters.yml file should look like
|
||||
parameters:
|
||||
# Uncomment these settings or manually update your parameters.yml
|
||||
# to use docker-compose
|
||||
#
|
||||
# database_driver: %env.database_driver%
|
||||
# database_host: %env.database_host%
|
||||
# database_port: %env.database_port%
|
||||
# database_name: %env.database_name%
|
||||
# database_user: %env.database_user%
|
||||
# database_password: %env.database_password%
|
||||
|
||||
database_driver: pdo_pgsql
|
||||
database_host: localhost
|
||||
database_port: ~
|
||||
database_name: wallabag
|
||||
database_user: wallabag
|
||||
database_password: wallabag
|
||||
# For SQLite, database_path should be "%kernel.project_dir%/data/db/wallabag.sqlite"
|
||||
database_path: ~
|
||||
database_table_prefix: wallabag_
|
||||
database_socket: null
|
||||
# with PostgreSQL and SQLite, you must set "utf8"
|
||||
database_charset: utf8
|
||||
|
||||
domain_name: http://read.mossnet.lan
|
||||
server_name: "mossnet wallabag instance"
|
||||
|
||||
mailer_transport: smtp
|
||||
mailer_user: ~
|
||||
mailer_password: ~
|
||||
mailer_host: 127.0.0.1
|
||||
mailer_port: false
|
||||
mailer_encryption: ~
|
||||
mailer_auth_mode: ~
|
||||
|
||||
locale: en
|
||||
|
||||
# A secret key that's used to generate certain security-related tokens
|
||||
secret: SAFGOECRIlfal89oe6u0(*^dsaaih961
|
||||
|
||||
# two factor stuff
|
||||
twofactor_auth: true
|
||||
twofactor_sender: no-reply@wallabag.org
|
||||
|
||||
# fosuser stuff
|
||||
fosuser_registration: true
|
||||
fosuser_confirmation: true
|
||||
|
||||
# how long the access token should live in seconds for the API
|
||||
fos_oauth_server_access_token_lifetime: 3600
|
||||
# how long the refresh token should life in seconds for the API
|
||||
fos_oauth_server_refresh_token_lifetime: 1209600
|
||||
|
||||
from_email: no-reply@wallabag.org
|
||||
|
||||
rss_limit: 50
|
||||
|
||||
# RabbitMQ processing
|
||||
rabbitmq_host: localhost
|
||||
rabbitmq_port: 5672
|
||||
rabbitmq_user: guest
|
||||
rabbitmq_password: guest
|
||||
rabbitmq_prefetch_count: 10
|
||||
|
||||
# Redis processing
|
||||
redis_scheme: tcp
|
||||
redis_host: localhost
|
||||
redis_port: 6379
|
||||
redis_path: null
|
||||
redis_password: null
|
||||
|
||||
# sentry logging
|
||||
sentry_dsn: ~
|
||||
'';
|
||||
};
|
||||
# networking.firewall.allowedTCPPorts = [ 8080 ];
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
boot.extraModulePackages = with config.boot.kernelPackages; [ wireguard ];
|
||||
environment.systemPackages = [ pkgs.wireguard ];
|
||||
networking.wireguard.enable = true;
|
||||
networking.wireguard.interfaces = {
|
||||
wg0 = {
|
||||
ips = [ "10.0.69.2/32" ];
|
||||
privateKeyFile = "/var/lib/wireguard/priv";
|
||||
|
||||
peers = [
|
||||
{ # helix - server
|
||||
publicKey = "{c1J4p63rD3IlszugMZiki7UBV3YmDdqa3DU4UejXzAI=}";
|
||||
allowedIPs = [ "10.0.69.1/24" ];
|
||||
endpoint = "sealight.xyz:60990";
|
||||
persistentKeepalive = 25;
|
||||
} ];
|
||||
};
|
||||
};
|
||||
}
|
10
bud/default.nix
Normal file
10
bud/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ pkgs, lib, budUtils, ... }: {
|
||||
bud.cmds = with pkgs; {
|
||||
get = {
|
||||
writer = budUtils.writeBashWithPaths [ nixUnstable git coreutils ];
|
||||
synopsis = "get [DEST]";
|
||||
help = "Copy the desired template to DEST";
|
||||
script = ./get.bash;
|
||||
};
|
||||
};
|
||||
}
|
1
bud/get.bash
Normal file
1
bud/get.bash
Normal file
|
@ -0,0 +1 @@
|
|||
nix flake new -t "github:divnix/devos/core" "${2:-devos}"
|
31
default.nix
Normal file
31
default.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
let
|
||||
inherit (default.inputs.nixos) lib;
|
||||
|
||||
default = (import ./lib/compat).defaultNix;
|
||||
|
||||
ciSystems = [
|
||||
"aarch64-linux"
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
filterSystems = lib.filterAttrs
|
||||
(system: _: lib.elem system ciSystems);
|
||||
|
||||
recurseIntoAttrsRecursive = lib.mapAttrs (_: v:
|
||||
if lib.isAttrs v
|
||||
then recurseIntoAttrsRecursive (lib.recurseIntoAttrs v)
|
||||
else v
|
||||
);
|
||||
|
||||
systemOutputs = lib.filterAttrs
|
||||
(name: set: lib.isAttrs set
|
||||
&& lib.any
|
||||
(system: set ? ${system} && name != "legacyPackages")
|
||||
ciSystems
|
||||
)
|
||||
default.outputs;
|
||||
|
||||
ciDrvs = lib.mapAttrs (_: system: filterSystems system) systemOutputs;
|
||||
in
|
||||
(recurseIntoAttrsRecursive ciDrvs) // { shell = import ./shell.nix; }
|
1
doc/.gitignore
vendored
Normal file
1
doc/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
book
|
18
doc/CONTRIBUTING.md
Normal file
18
doc/CONTRIBUTING.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Pull Requests
|
||||
|
||||
## TL;DR;
|
||||
- **Target Branch**: `main`
|
||||
- **Merge Policy**: [`bors`][bors] is alwyas right (→ `bors try`)
|
||||
- **Docs**: every changeset is expected to contain doc updates
|
||||
- **Commit Msg**: be a poet! Comprehensive and explanatory commit messages
|
||||
should cover the motivation and use case in an easily understandable manner
|
||||
even when read after a few months.
|
||||
- **Test Driven Development**: please default to test driven development where possible.
|
||||
|
||||
### Within the Devshell (`nix develop`)
|
||||
- **Hooks**: please `git commit` within the devshell
|
||||
- **Fail Early**: please run from within the devshell on your local machine:
|
||||
- `nix flake check`
|
||||
|
||||
[bors]: https://bors.tech
|
||||
|
28
doc/SUMMARY.md
Normal file
28
doc/SUMMARY.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Summary
|
||||
|
||||
- [Introduction](../README.md)
|
||||
- [Quick Start](./start/index.md)
|
||||
- [ISO](./start/iso.md)
|
||||
- [Bootstrapping](./start/bootstrapping.md)
|
||||
- [From NixOS](./start/from-nixos.md)
|
||||
- [Key Concepts](./concepts/index.md)
|
||||
- [Hosts](./concepts/hosts.md)
|
||||
- [Overrides](./concepts/overrides.md)
|
||||
- [Profiles](./concepts/profiles.md)
|
||||
- [Suites](./concepts/suites.md)
|
||||
- [Users](./concepts/users.md)
|
||||
- [Outputs](./outputs/index.md)
|
||||
- [Modules](./outputs/modules.md)
|
||||
- [Overlays](./outputs/overlays.md)
|
||||
- [Packages](./outputs/pkgs.md)
|
||||
- [Concerns]()
|
||||
- [Secrets](./secrets.md)
|
||||
- [Tests](./tests.md)
|
||||
- [Helper Script – `bud`](./bud/index.md)
|
||||
- [get](./bud/get.md)
|
||||
- [Integrations](./integrations/index.md)
|
||||
- [Cachix](./integrations/cachix.md)
|
||||
- [Deploy RS](./integrations/deploy.md)
|
||||
- [NvFetcher](./integrations/nvfetcher.md)
|
||||
- [Hercules CI](./integrations/hercules.md)
|
||||
- [Contributing](./CONTRIBUTING.md)
|
6
doc/book.toml
Normal file
6
doc/book.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[book]
|
||||
authors = ["Timothy DeHerrera"]
|
||||
language = "en"
|
||||
multilingual = false
|
||||
src = "."
|
||||
title = "devos docs"
|
10
doc/bud/get.md
Normal file
10
doc/bud/get.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# get
|
||||
The `get` subcommand is useful for getting a bare copy of devos without the
|
||||
git history.
|
||||
|
||||
## Usage
|
||||
```sh
|
||||
bud get DEST-DIR
|
||||
```
|
||||
|
||||
If DEST-DIR is ommitted, it defaults to _./devos_.
|
24
doc/bud/index.md
Normal file
24
doc/bud/index.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# [`bud`][bud] command
|
||||
The template incudes a convenient script for managing your system called [`bud`][bud].
|
||||
|
||||
It is a portable and highly composable system control tool that work anywhere on your host
|
||||
or in the flake's devshell.
|
||||
|
||||
Although it comes with some predefined standard helpers,
|
||||
it is very extensible and you are encouraged to write your own script snippets
|
||||
to ease your workflows. An example is the bud module for a `get` command that
|
||||
comes included with `devos`.
|
||||
|
||||
While writing scripts you can convenientely access smart environment variables
|
||||
that can tell the current architecture, user or host name, among others, regardless
|
||||
wether you invoke `bud` within the devshell or as the system-wide installed `bud`.
|
||||
|
||||
For details, please review the [bud repo][bud].
|
||||
|
||||
## Usage
|
||||
```sh
|
||||
bud help
|
||||
```
|
||||
|
||||
|
||||
[bud]: https://github.com/divnix/bud
|
62
doc/concepts/hosts.md
Normal file
62
doc/concepts/hosts.md
Normal file
|
@ -0,0 +1,62 @@
|
|||
# Hosts
|
||||
|
||||
Nix flakes contain an output called `nixosConfigurations` declaring an
|
||||
attribute set of valid NixOS systems. To simplify the management and creation
|
||||
of these hosts, devos automatically imports every _.nix_ file inside this
|
||||
directory to the mentioned attribute set, applying the projects defaults to
|
||||
each. The only hard requirement is that the file contain a valid NixOS module.
|
||||
|
||||
As an example, a file `hosts/system.nix` or `hosts/system/default.nix` will
|
||||
be available via the flake output `nixosConfigurations.system`. You can have
|
||||
as many hosts as you want and all of them will be automatically imported based
|
||||
on their name.
|
||||
|
||||
For each host, the configuration automatically sets the `networking.hostName`
|
||||
attribute to the folder name or name of the file minus the _.nix_ extension. This
|
||||
is for convenience, since `nixos-rebuild` automatically searches for a configuration
|
||||
matching the current systems hostname if one is not specified explicitly.
|
||||
|
||||
You can set channels, systems, and add extra modules to each host by editing the
|
||||
`nixos.hosts` argument in flake.nix. This is the perfect place to import
|
||||
host specific modules from external sources, such as the
|
||||
[nixos-hardware][nixos-hardware] repository.
|
||||
|
||||
It is recommended that the host modules only contain configuration information
|
||||
specific to a particular piece of hardware. Anything reusable across machines
|
||||
is best saved for [profile modules](./profiles.md).
|
||||
|
||||
This is a good place to import sets of profiles, called [suites](./suites.md),
|
||||
that you intend to use on your machine.
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
flake.nix:
|
||||
```nix
|
||||
{
|
||||
nixos = {
|
||||
imports = [ (devos.lib.importHosts ./hosts) ];
|
||||
hosts = {
|
||||
librem = {
|
||||
channelName = "latest";
|
||||
modules = [ nixos-hardware.nixosModules.purism-librem-13v3 ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
hosts/librem.nix:
|
||||
```nix
|
||||
{ suites, ... }:
|
||||
{
|
||||
imports = suites.laptop;
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };
|
||||
}
|
||||
```
|
||||
|
||||
[nixos-hardware]: https://github.com/NixOS/nixos-hardware
|
10
doc/concepts/index.md
Normal file
10
doc/concepts/index.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Key Concepts
|
||||
|
||||
Key concepts are derived from [digga][digga]. Please refer to its
|
||||
[docs][digga-docs] for more details.
|
||||
|
||||
This section is dedicated to helping you develop a more hands on
|
||||
understanding of them them.
|
||||
|
||||
[digga-docs]: https://digga.divnix.com
|
||||
[digga]: https://github.com/divnix/digga
|
42
doc/concepts/overrides.md
Normal file
42
doc/concepts/overrides.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Overrides
|
||||
Each NixOS host follows one channel. But many times it is useful to get packages
|
||||
or modules from different channels.
|
||||
|
||||
## Packages
|
||||
You can make use of `overlays/overrides.nix` to override specific packages in the
|
||||
default channel to be pulled from other channels. That file is simply an example
|
||||
of how any overlay can get `channels` as their first argument.
|
||||
|
||||
You can add overlays to any channel to override packages from other channels.
|
||||
|
||||
Pulling the manix package from the `latest` channel:
|
||||
```nix
|
||||
channels: final: prev: {
|
||||
__dontExport = true;
|
||||
inherit (pkgs.latest) manix;
|
||||
}
|
||||
```
|
||||
|
||||
It is recommended to set the `__dontExport` property for override specific
|
||||
overlays. `overlays/overrides.nix` is the best place to consolidate all package
|
||||
overrides and the property is already set for you.
|
||||
|
||||
## Modules
|
||||
|
||||
You can also pull modules from other channels. All modules have access to the
|
||||
`modulesPath` for each channel as `<channelName>ModulesPath`. And you can use
|
||||
`disabledModules` to remove modules from the current channel.
|
||||
|
||||
To pull zsh module from the `latest` channel this code can be placed in any module, whether its your host file, a profile, or a module in ./modules etc:
|
||||
```nix
|
||||
{ latestModulesPath }:
|
||||
{
|
||||
imports = [ "${latestModulesPath}/programs/zsh/zsh.nix" ];
|
||||
disabledModules = [ "programs/zsh/zsh.nix" ];
|
||||
}
|
||||
```
|
||||
|
||||
> ##### _Note:_
|
||||
> Sometimes a modules name will change from one branch to another.
|
||||
|
||||
[nixpkgs-modules]: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules
|
67
doc/concepts/profiles.md
Normal file
67
doc/concepts/profiles.md
Normal file
|
@ -0,0 +1,67 @@
|
|||
# Profiles
|
||||
|
||||
Profiles are a convenient shorthand for the [_definition_][definition] of
|
||||
[options][options] in contrast to their [_declaration_][declaration]. They're
|
||||
built into the NixOS module system for a reason: to elegantly provide a clear
|
||||
separation of concerns.
|
||||
|
||||
## Creation
|
||||
Profiles are created with the `rakeLeaves` function which recursively collects
|
||||
`.nix` files from within a folder. The recursion stops at folders with a `default.nix`
|
||||
in them. You end up with an attribute set with leaves(paths to profiles) or
|
||||
nodes(attrsets leading to more nodes or leaves).
|
||||
|
||||
A profile is used for quick modularization of [interelated bits](./profiles.md#subprofiles).
|
||||
|
||||
> ##### _Notes:_
|
||||
> * For _declaring_ module options, there's the [modules](../outputs/modules.md) directory.
|
||||
> * This directory takes inspiration from
|
||||
> [upstream](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/profiles)
|
||||
> .
|
||||
|
||||
### Nested profiles
|
||||
Profiles can be nested in attribute sets due to the recursive nature of `rakeLeaves`.
|
||||
This can be useful to have a set of profiles created for a specific purpose. It is
|
||||
sometimes useful to have a `common` profile that has high level concerns related
|
||||
to all its sister profiles.
|
||||
|
||||
### Example
|
||||
|
||||
profiles/develop/common.nix:
|
||||
```nix
|
||||
{
|
||||
imports = [ ./zsh ];
|
||||
# some generic development concerns ...
|
||||
}
|
||||
```
|
||||
|
||||
profiles/develop/zsh.nix:
|
||||
```nix
|
||||
{ ... }:
|
||||
{
|
||||
programs.zsh.enable = true;
|
||||
# zsh specific options ...
|
||||
}
|
||||
```
|
||||
|
||||
The examples above will end up with a profiles set like this:
|
||||
```nix
|
||||
{
|
||||
develop = {
|
||||
common = ./profiles/develop/common.nix;
|
||||
zsh = ./profiles/develop/zsh.nix;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
Profiles are the most important concept in DevOS. They allow us to keep our
|
||||
Nix expressions self contained and modular. This way we can maximize reuse
|
||||
across hosts while minimizing boilerplate. Remember, anything machine
|
||||
specific belongs in your [host](hosts.md) files instead.
|
||||
|
||||
[definition]: https://nixos.org/manual/nixos/stable/index.html#sec-option-definitions
|
||||
[declaration]: https://nixos.org/manual/nixos/stable/index.html#sec-option-declarations
|
||||
[options]: https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules
|
||||
[spec]: https://github.com/divnix/devos/tree/core/lib/devos/mkProfileAttrs.nix
|
||||
[config]: https://nixos.wiki/wiki/Module#structure
|
25
doc/concepts/suites.md
Normal file
25
doc/concepts/suites.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Suites
|
||||
Suites provide a mechanism for users to easily combine and name collecitons of
|
||||
profiles.
|
||||
|
||||
`suites` are defined in the `importables` argument in either the `home` or `nixos`
|
||||
namespace. They are a special case of an `importable` which get passed as a special
|
||||
argument (one that can be use in an `imports` line) to your hosts. All lists defined
|
||||
in `suites` are flattened and type-checked as paths.
|
||||
|
||||
## Definition
|
||||
```nix
|
||||
rec {
|
||||
workstation = [ profiles.develop profiles.graphical users.nixos ];
|
||||
mobileWS = workstation ++ [ profiles.laptop ];
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
`hosts/my-laptop.nix`:
|
||||
```nix
|
||||
{ suites, ... }:
|
||||
{
|
||||
imports = suites.mobileWS;
|
||||
}
|
||||
```
|
77
doc/concepts/users.md
Normal file
77
doc/concepts/users.md
Normal file
|
@ -0,0 +1,77 @@
|
|||
> ##### _Note:_
|
||||
> This section and its semantics need a conceptiual rework.
|
||||
> Since recently [portable home configurations][portableuser]
|
||||
> that are not bound to any specific host are a thing.
|
||||
|
||||
# Users
|
||||
|
||||
Users are a special case of [profiles](profiles.md) that define system
|
||||
users and [home-manager][home-manager] configurations. For your convenience,
|
||||
home manager is wired in by default so all you have to worry about is declaring
|
||||
your users. For a fully fleshed out example, check out the developers personal
|
||||
[branch](https://github.com/divnix/devos/tree/nrd/users/nrd/default.nix).
|
||||
|
||||
## Basic Usage
|
||||
`users/myuser/default.nix`:
|
||||
```nix
|
||||
{ ... }:
|
||||
{
|
||||
users.users.myuser = {
|
||||
isNormalUser = true;
|
||||
};
|
||||
|
||||
home-manager.users.myuser = {
|
||||
programs.mpv.enable = true;
|
||||
};
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Home Manager
|
||||
Home Manager support follows the same principles as regular nixos configurations,
|
||||
it even gets its own namespace in your `flake.nix` as `home`.
|
||||
|
||||
All modules defined in [user modules][modules-list] will be imported to
|
||||
Home Manager.
|
||||
User profiles can be collected in a similar fashion as system ones into a `suites`
|
||||
argument that gets passed to your home-manager users.
|
||||
|
||||
### Example
|
||||
```nix
|
||||
{
|
||||
home-manager.users.nixos = { suites, ... }: {
|
||||
imports = suites.base;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## External Usage
|
||||
You can easily use the defined home-manager configurations outside of NixOS
|
||||
using the `homeConfigurations` flake output. The [flk](../flk/index.md) helper
|
||||
script makes this even easier.
|
||||
|
||||
This is great for keeping your environment consistent across Unix systems,
|
||||
including OSX.
|
||||
|
||||
### From within the projects devshell:
|
||||
```sh
|
||||
# builds the nixos user defined in the NixOS host
|
||||
flk home NixOS nixos
|
||||
|
||||
# build and activate
|
||||
flk home NixOS nixos switch
|
||||
```
|
||||
|
||||
### Manually from outside the project:
|
||||
```sh
|
||||
# build
|
||||
nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPackage"
|
||||
|
||||
# activate
|
||||
./result/activate && unlink result
|
||||
```
|
||||
|
||||
[home-manager]: https://nix-community.github.io/home-manager
|
||||
[modules-list]: https://github.com/divnix/devos/tree/core/users/modules/module-list.nix
|
||||
[portableuser]: https://digga.divnix.com/api-reference-home.html#homeusers
|
17
doc/integrations/cachix.md
Normal file
17
doc/integrations/cachix.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Cachix
|
||||
The system will automatically pull a cachix.nix at the root if one exists.
|
||||
This is usually created automatically by a `sudo cachix use`. If you're more
|
||||
inclined to keep the root clean, you can drop any generated files in the
|
||||
`cachix` directory into the `profiles/cachix` directory without further
|
||||
modification.
|
||||
|
||||
For example, to add your own cache, assuming the template lives in /etc/nixos,
|
||||
by simply running `sudo cachix use yourcache`. Then, optionally, move
|
||||
`cachix/yourcache.nix` to `profiles/cachix/yourcache.nix`
|
||||
|
||||
These caches are only added to the system after a `nixos-rebuild switch`, so it
|
||||
is recommended to call `cachix use nrdxp` before the initial deployment, as it
|
||||
will save a lot of build time.
|
||||
|
||||
In the future, users will be able to skip this step once the ability to define
|
||||
the nix.conf within the flake is fully fleshed out upstream.
|
49
doc/integrations/deploy.md
Normal file
49
doc/integrations/deploy.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
# deploy-rs
|
||||
[Deploy-rs][d-rs] is a tool for managing NixOS remote machines. It was
|
||||
chosen for devos after the author experienced some frustrations with the
|
||||
stateful nature of nixops' db. It was also designed from scratch to support
|
||||
flake based deployments, and so is an excellent tool for the job.
|
||||
|
||||
By default, all the [hosts](../concepts/hosts.md) are also available as deploy-rs nodes,
|
||||
configured with the hostname set to `networking.hostName`; overridable via
|
||||
the command line.
|
||||
|
||||
## Usage
|
||||
|
||||
Just add your ssh key to the host:
|
||||
```nix
|
||||
{ ... }:
|
||||
{
|
||||
users.users.${sshUser}.openssh.authorizedKeys.keyFiles = [
|
||||
../secrets/path/to/key.pub
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
And the private key to your user:
|
||||
```nix
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.${sshUser}.programs.ssh = {
|
||||
enable = true;
|
||||
|
||||
matchBlocks = {
|
||||
${host} = {
|
||||
host = hostName;
|
||||
identityFile = ../secrets/path/to/key;
|
||||
extraOptions = { AddKeysToAgent = "yes"; };
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
And run the deployment:
|
||||
```sh
|
||||
deploy "flk#hostName" --hostname host.example.com
|
||||
```
|
||||
|
||||
> ##### _Note:_
|
||||
> Your user will need **passwordless** sudo access
|
||||
|
||||
[d-rs]: https://github.com/serokell/deploy-rs
|
36
doc/integrations/hercules.md
Normal file
36
doc/integrations/hercules.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Hercules CI
|
||||
If you start adding your own packages and configurations, you'll probably have
|
||||
at least a few binary artifacts. With hercules we can build every package in
|
||||
our configuration automatically, on every commit. Additionally, we can have it
|
||||
upload all our build artifacts to a binary cache like [cachix][cachix].
|
||||
|
||||
This will work whether your copy is a fork, or a bare template, as long as your
|
||||
repo is hosted on GitHub.
|
||||
|
||||
## Setup
|
||||
Just head over to [hercules-ci.com](https://hercules-ci.com) to make an account.
|
||||
|
||||
Then follow the docs to set up an [agent][agent], if you want to deploy to a
|
||||
binary cache (and of course you do), be sure _not_ to skip the
|
||||
[binary-caches.json][cache].
|
||||
|
||||
## Ready to Use
|
||||
The repo is already set up with the proper _default.nix_ file, building all
|
||||
declared packages, checks, profiles and shells. So you can see if something
|
||||
breaks, and never build the same package twice!
|
||||
|
||||
If you want to get fancy, you could even have hercules
|
||||
[deploy your configuration](https://docs.hercules-ci.com/hercules-ci-effects/guide/deploy-a-nixos-machine/)!
|
||||
|
||||
> ##### _Note:_
|
||||
> Hercules doesn't have access to anything encrypted in the
|
||||
> [secrets folder](../../secrets), so none of your secrets will accidentally get
|
||||
> pushed to a cache by mistake.
|
||||
>
|
||||
> You could pull all your secrets via your user, and then exclude it from
|
||||
> [allUsers](https://github.com/nrdxp/devos/blob/nrd/suites/default.nix#L17)
|
||||
> to keep checks passing.
|
||||
|
||||
[agent]: https://docs.hercules-ci.com/hercules-ci/getting-started/#github
|
||||
[cache]: https://docs.hercules-ci.com/hercules-ci/getting-started/deploy/nixos/#_3_configure_a_binary_cache
|
||||
[cachix]: https://cachix.org
|
5
doc/integrations/index.md
Normal file
5
doc/integrations/index.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Integrations
|
||||
This section explores some of the optional tools included with devos to provide
|
||||
a solution to common concerns such as ci and remote deployment. An effort is
|
||||
made to choose tools that treat nix, and where possible flakes, as first class
|
||||
citizens.
|
43
doc/integrations/nvfetcher.md
Normal file
43
doc/integrations/nvfetcher.md
Normal file
|
@ -0,0 +1,43 @@
|
|||
# nvfetcher
|
||||
[NvFetcher][nvf] is a workflow companion for updating nix sources.
|
||||
|
||||
You can specify an origin source and an update configuration, and
|
||||
nvfetcher can for example track updates to a specific branch and
|
||||
automatically update your nix sources configuration on each run
|
||||
to the tip of that branch.
|
||||
|
||||
All package source declaration is done in [sources.toml][sources.toml].
|
||||
|
||||
From within the devshell of this repo, run `nvfetcher`, a wrapped
|
||||
version of `nvfetcher` that knows where to find and place its files
|
||||
and commit the results.
|
||||
|
||||
## Usage
|
||||
|
||||
Statically fetching (not tracking) a particular tag from a github repo:
|
||||
```toml
|
||||
[manix]
|
||||
src.manual = "v0.6.3"
|
||||
fetch.github = "mlvzk/manix"
|
||||
```
|
||||
|
||||
Tracking the latest github _release_ from a github repo:
|
||||
```toml
|
||||
[manix]
|
||||
src.github = "mlvzk/manix" # responsible for tracking
|
||||
fetch.github = "mlvzk/manix" # responsible for fetching
|
||||
```
|
||||
|
||||
Tracking the latest commit of a git repository and fetch from a git repo:
|
||||
```toml
|
||||
[manix]
|
||||
src.git = "https://github.com/mlvzk/manix.git" # responsible for tracking
|
||||
fetch.git = "https://github.com/mlvzk/manix.git" # responsible for fetching
|
||||
```
|
||||
|
||||
> ##### _Note:_
|
||||
> Please refer to the [NvFetcher Readme][nvf-readme] for more options.
|
||||
|
||||
[nvf]: https://github.com/berberman/nvfetcher
|
||||
[nvf-readme]: https://github.com/berberman/nvfetcher#readme
|
||||
[sources.toml]: https://github.com/divnix/devos/tree/core/pkgs/sources.toml
|
3
doc/outputs/index.md
Normal file
3
doc/outputs/index.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Layout
|
||||
Each of the following sections is a directory whose contents are output to the
|
||||
outside world via the flake's outputs. Check each chapter for details.
|
79
doc/outputs/modules.md
Normal file
79
doc/outputs/modules.md
Normal file
|
@ -0,0 +1,79 @@
|
|||
# Modules
|
||||
The modules directory is a replica of nixpkg's NixOS [modules][nixpkgs-modules]
|
||||
, and follows the same semantics. This allows for trivial upstreaming into
|
||||
nixpkgs proper once your module is sufficiently stable.
|
||||
|
||||
All modules linked in _module-list.nix_ are automatically exported via
|
||||
`nixosModules.<file-basename>`, and imported into all [hosts](../concepts/hosts.md).
|
||||
|
||||
|
||||
> ##### _Note:_
|
||||
> This is reserved for declaring brand new module options. If you just want to
|
||||
> declare a coherent configuration of already existing and related NixOS options
|
||||
> , use [profiles](../concepts/profiles.md) instead.
|
||||
|
||||
## Semantics
|
||||
In case you've never written a module for nixpkgs before, here is a brief
|
||||
outline of the process.
|
||||
|
||||
### Declaration
|
||||
modules/services/service-category/my-service.nix:
|
||||
```nix
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.services.myService;
|
||||
in
|
||||
{
|
||||
options.services.myService = {
|
||||
enable = lib.mkEnableOption "Description of my new service.";
|
||||
|
||||
# additional options ...
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# implementation ...
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Import
|
||||
modules/module-list.nix:
|
||||
```nix
|
||||
[
|
||||
./services/service-category/my-service.nix
|
||||
]
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Internal
|
||||
profiles/profile-category/my-profile.nix:
|
||||
```nix
|
||||
{ ... }:
|
||||
{
|
||||
services.MyService.enable = true;
|
||||
}
|
||||
```
|
||||
|
||||
### External
|
||||
flake.nix:
|
||||
```nix
|
||||
{
|
||||
# inputs omitted
|
||||
|
||||
outputs = { self, devos, nixpkgs, ... }: {
|
||||
nixosConfigurations.myConfig = nixpkgs.lib.nixosSystem {
|
||||
system = "...";
|
||||
|
||||
modules = [
|
||||
devos.nixosModules.my-service
|
||||
({ ... }: {
|
||||
services.MyService.enable = true;
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
[nixpkgs-modules]: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules
|
25
doc/outputs/overlays.md
Normal file
25
doc/outputs/overlays.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Overlays
|
||||
Writing overlays is a common occurence when using a NixOS system. Therefore,
|
||||
we want to keep the process as simple and straightforward as possible.
|
||||
|
||||
Any _.nix_ files declared in this directory will be assumed to be a valid
|
||||
overlay, and will be automatically imported into all [hosts](../concepts/hosts.md), and
|
||||
exported via `overlays.<channel>/<pkgName>` _as well as_
|
||||
`packages.<system>.<pkgName>` (for valid systems), so all you have to do is
|
||||
write it.
|
||||
|
||||
## Example
|
||||
overlays/kakoune.nix:
|
||||
```nix
|
||||
final: prev: {
|
||||
kakoune = prev.kakoune.override {
|
||||
configure.plugins = with final.kakounePlugins; [
|
||||
(kak-fzf.override { fzf = final.skim; })
|
||||
kak-auto-pairs
|
||||
kak-buffers
|
||||
kak-powerline
|
||||
kak-vertical-selection
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
109
doc/outputs/pkgs.md
Normal file
109
doc/outputs/pkgs.md
Normal file
|
@ -0,0 +1,109 @@
|
|||
# Packages
|
||||
Similar to [modules](./modules.md), the pkgs directory mirrors the upstream
|
||||
[nixpkgs/pkgs][pkgs], and for the same reason; if you ever want to upstream
|
||||
your package, it's as simple as dropping it into the nixpkgs/pkgs directory.
|
||||
|
||||
The only minor difference is that, instead of adding the `callPackage` call to
|
||||
`all-packages.nix`, you just add it the the _default.nix_ in this directory,
|
||||
which is defined as a simple overlay.
|
||||
|
||||
All the packages are exported via `packages.<system>.<pkg-name>`, for all
|
||||
the supported systems listed in the package's `meta.platforms` attribute.
|
||||
|
||||
And, as usual, every package in the overlay is also available to any NixOS
|
||||
[host](../concepts/hosts.md).
|
||||
|
||||
Another convenient difference is that it is possible to use
|
||||
[nvfetcher](https://github.com/berberman/nvfetcher) to keep packages up to
|
||||
date.
|
||||
This is best understood by the simple example below.
|
||||
|
||||
## Example
|
||||
It is possible to specify sources separately to keep them up to date semi
|
||||
automatically.
|
||||
The basic rules are specified in pkgs/sources.toml:
|
||||
```toml
|
||||
# nvfetcher.toml
|
||||
[libinih]
|
||||
src.github = "benhoyt/inih"
|
||||
fetch.github = "benhoyt/inih"
|
||||
```
|
||||
After changes to this file as well as to update the packages specified in there run
|
||||
nvfetcher (for more details see [nvfetcher](https://github.com/berberman/nvfetcher)).
|
||||
|
||||
The pkgs overlay is managed in
|
||||
pkgs/default.nix:
|
||||
```nix
|
||||
final: prev: {
|
||||
# keep sources first, this makes sources available to the pkgs
|
||||
sources = prev.callPackage (import ./_sources/generated.nix) { };
|
||||
|
||||
# then, call packages with `final.callPackage`
|
||||
libinih = prev.callPackage ./development/libraries/libinih { };
|
||||
}
|
||||
```
|
||||
|
||||
Lastly the example package is in
|
||||
pkgs/development/libraries/libinih/default.nix:
|
||||
```nix
|
||||
{ stdenv, meson, ninja, lib, sources, ... }:
|
||||
stdenv.mkDerivation {
|
||||
pname = "libinih";
|
||||
|
||||
# version will resolve to the latest available on gitub
|
||||
inherit (sources.libinih) version src;
|
||||
|
||||
buildInputs = [ meson ninja ];
|
||||
|
||||
# ...
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Migration from flake based approach
|
||||
Previous to nvfetcher it was possible to manage sources via a pkgs/flake.nix, the main changes from there are that sources where in the attribute "srcs" (now "sources") and the contents of the sources where slightly different.
|
||||
In order to switch to the new system, rewrite pkgs/flake.nix to a pkgs/sources.toml file using the documentation of nvfetcher,
|
||||
add the line that calls the sources at the beginning of pkgs/default.nix, and
|
||||
accomodate the small changes in the packages as can be seen from the example.
|
||||
|
||||
The example package looked like:
|
||||
|
||||
pkgs/flake.nix:
|
||||
```nix
|
||||
{
|
||||
description = "Package sources";
|
||||
|
||||
inputs = {
|
||||
libinih.url = "github:benhoyt/inih/r53";
|
||||
libinih.flake = false;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
pkgs/default.nix:
|
||||
```nix
|
||||
final: prev: {
|
||||
# then, call packages with `final.callPackage`
|
||||
libinih = prev.callPackage ./development/libraries/libinih { };
|
||||
}
|
||||
```
|
||||
|
||||
pkgs/development/libraries/libinih/default.nix:
|
||||
```nix
|
||||
{ stdenv, meson, ninja, lib, srcs, ... }:
|
||||
let inherit (srcs) libinih; in
|
||||
stdenv.mkDerivation {
|
||||
pname = "libinih";
|
||||
|
||||
# version will resolve to 53, as specified in the flake.nix file
|
||||
inherit (libinih) version;
|
||||
|
||||
src = libinih;
|
||||
|
||||
buildInputs = [ meson ninja ];
|
||||
|
||||
# ...
|
||||
}
|
||||
```
|
||||
|
||||
[pkgs]: https://github.com/NixOS/nixpkgs/tree/master/pkgs
|
110
doc/secrets.md
Normal file
110
doc/secrets.md
Normal file
|
@ -0,0 +1,110 @@
|
|||
# Secrets
|
||||
Secrets are managed using [git-crypt][git-crypt] and [agenix][agenix]
|
||||
so you can keep your flake in a public repository like GitHub without
|
||||
exposing your password or other sensitive data.
|
||||
|
||||
By default, everything in the secrets folder is automatically encrypted. Just
|
||||
be sure to run `git-crypt init` before putting anything in here.
|
||||
|
||||
## Agenix
|
||||
Currently, there is [no mechanism][secrets-issue] in nix itself to deploy secrets
|
||||
within the nix store because it is world-readable.
|
||||
|
||||
Most NixOS modules have the ability to set options to files in the system, outside
|
||||
the nix store, that contain sensitive information. You can use [agenix][agenix]
|
||||
to easily setup those secret files declaratively.
|
||||
|
||||
[agenix][agenix] encrypts secrets and stores them as .age files in your repository.
|
||||
Age files are encrypted with multiple ssh public keys, so any host or user with a
|
||||
matching ssh private key can read the data. The [age module][age module] will add those
|
||||
encrypted files to the nix store and decrypt them on activation to `/run/secrets`.
|
||||
|
||||
### Setup
|
||||
All hosts must have openssh enabled, this is done by default in the core profile.
|
||||
|
||||
You need to populate your `secrets/secrets.nix` with the proper ssh public keys.
|
||||
Be extra careful to make sure you only add public keys, you should never share a
|
||||
private key!!
|
||||
|
||||
secrets/secrets.nix:
|
||||
```nix
|
||||
let
|
||||
system = "<system ssh key>";
|
||||
user = "<user ssh key>";
|
||||
allKeys = [ system user ];
|
||||
in
|
||||
```
|
||||
|
||||
On most systems, you can get your systems ssh public key from `/etc/ssh/ssh_host_ed25519_key.pub`. If
|
||||
this file doesn't exist you likely need to enable openssh and rebuild your system.
|
||||
|
||||
Your users ssh public key is probably stored in `~/.ssh/id_ed25519.pub` or
|
||||
`~/.ssh/id_rsa.pub`. If you haven't generated a ssh key yet, be sure do so:
|
||||
```sh
|
||||
ssh-keygen -t ed25519
|
||||
```
|
||||
|
||||
> ##### _Note:_
|
||||
> The underlying tool used by agenix, rage, doesn't work well with password protected
|
||||
> ssh keys. So if you have lots of secrets you might have to type in your password many
|
||||
> times.
|
||||
|
||||
|
||||
### Secrets
|
||||
You will need the `agenix` command to create secrets. DevOS conveniently provides that
|
||||
in the devShell, so just run `nix develop` whenever you want to edit secrets. Make sure
|
||||
to always run `agenix` while in the `secrets/` folder, so it can pick up your `secrets.nix`.
|
||||
|
||||
To create secrets, simply add lines to your `secrets/secrets.nix`:
|
||||
```
|
||||
let
|
||||
...
|
||||
allKeys = [ system user ];
|
||||
in
|
||||
{
|
||||
"secret.age".publicKeys = allKeys;
|
||||
}
|
||||
```
|
||||
That would tell agenix to create a `secret.age` file that is encrypted with the `system`
|
||||
and `user` ssh public key.
|
||||
|
||||
Then go into the `secrets` folder and run:
|
||||
```sh
|
||||
agenix -e secret.age
|
||||
```
|
||||
This will create the `secret.age`, if it doesn't already exist, and allow you to edit it.
|
||||
|
||||
If you ever change the `publicKeys` entry of any secret make sure to rekey the secrets:
|
||||
```sh
|
||||
agenix --rekey
|
||||
```
|
||||
|
||||
### Usage
|
||||
Once you have your secret file encrypted and ready to use, you can utilize the [age module][age module]
|
||||
to ensure that your secrets end up in `/run/secrets`.
|
||||
|
||||
In any profile that uses a NixOS module that requires a secret you can enable a particular secret like so:
|
||||
|
||||
```nix
|
||||
{ self, ... }:
|
||||
{
|
||||
age.secrets.mysecret.file = "${self}/secrets/mysecret.age";
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Then you can just pass the path `/run/secrets/mysecret` to the module.
|
||||
|
||||
You can make use of the many options provided by the age module to customize where and how
|
||||
secrets get decrypted. You can learn about them by looking at the
|
||||
[age module][age module].
|
||||
|
||||
|
||||
> ##### _Note:_
|
||||
> You can take a look at the [agenix repository][agenix] for more information
|
||||
> about the tool.
|
||||
|
||||
[git-crypt]: https://github.com/AGWA/git-crypt
|
||||
[agenix]: https://github.com/ryantm/agenix
|
||||
[age module]: https://github.com/ryantm/agenix/blob/master/modules/age.nix
|
||||
[secrets-issue]: https://github.com/NixOS/nix/issues/8
|
102
doc/start/bootstrapping.md
Normal file
102
doc/start/bootstrapping.md
Normal file
|
@ -0,0 +1,102 @@
|
|||
# Bootstrapping
|
||||
|
||||
This will help you boostrap a bare host with the help of the
|
||||
[bespoke iso](./iso.md) live installer.
|
||||
|
||||
_Note: nothing prevents you from remotely executing the boostrapping
|
||||
process. See below._
|
||||
|
||||
Once your target host has booted into the live iso, you need to partion
|
||||
and format your disk according to the [official manual][manual].
|
||||
|
||||
## Mount partitions
|
||||
|
||||
Then properly mount the formatted partitions at `/mnt`, so that you can
|
||||
install your system to those new partitions.
|
||||
|
||||
Mount `nixos` partition to `/mnt` and — for UEFI — `boot`
|
||||
partition to `/mnt/boot`:
|
||||
|
||||
```console
|
||||
$ mount /dev/disk/by-label/nixos /mnt
|
||||
$ mkdir -p /mnt/boot && mount /dev/disk/by-label/boot /mnt/boot # UEFI only
|
||||
$ swapon /dev/disk/by-label/swap
|
||||
```
|
||||
|
||||
Add some extra space to the store. In the iso, it's running on a tmpfs
|
||||
off your RAM:
|
||||
```console
|
||||
$ mkdir -p /mnt/tmpstore/{work,store}
|
||||
$ mount -t overlay overlay -olowerdir=/nix/store,upperdir=/mnt/tmpstore/store,workdir=/mnt/tmpstore/work /nix/store
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
Install off of a copy of devos from the time the iso was built:
|
||||
|
||||
```console
|
||||
$ cd /iso/devos
|
||||
$ nixos-install --flake .#NixOS
|
||||
```
|
||||
|
||||
## Notes of interest
|
||||
|
||||
### Remote access to the live installer
|
||||
|
||||
The iso live installer comes preconfigured with a network configuration
|
||||
which announces it's hostname via [MulticastDNS][mDNS] as `hostname.local`,
|
||||
that is `bootstrap.local` in the [iso example](./iso).
|
||||
|
||||
In the rare case that [MulticastDNS][mDNS] is not availabe or turned off
|
||||
in your network, there is a static link-local IPv6 address configured to
|
||||
`fe80::47`(mnemonic from the letter's position in the english alphabet:
|
||||
`n=14 i=9 x=24; 47 = n+i+x`).
|
||||
|
||||
Provided that you have added your public key to the authorized keys of the
|
||||
`root` user _(hint: [`deploy-rs`](../integrations/deploy.md) needs passwordless
|
||||
sudo access)_:
|
||||
|
||||
```nix
|
||||
{ ... }:
|
||||
{
|
||||
users.users.root.openssh.authorizedKeys.keyFiles = [
|
||||
../secrets/path/to/key.pub
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
You can then ssh into the live installer through one of the
|
||||
following options:
|
||||
|
||||
```console
|
||||
ssh root@bootstrap.local
|
||||
|
||||
ssh root@fe80::47%eno1 # where eno1 is your network interface on which you are linked to the target
|
||||
```
|
||||
|
||||
_Note: the [static link-local IPv6 address][staticLLA] and [MulticastDNS][mDNS] is only
|
||||
configured on the live installer. If you wish to enable [MulticastDNS][mDNS]
|
||||
for your environment, you ought to configure that in a regular [profile](../concepts/profiles.md)._
|
||||
|
||||
### EUI-64 LLA & Host Identity
|
||||
|
||||
The iso's IPv6 Link Local Address (LLA) is configured with a static 64-bit Extended
|
||||
Unique Identifiers (EUI-64) that is derived from the host interface's Message
|
||||
Authentication Code (MAC) address.
|
||||
|
||||
After a little while (a few seconds), you can remotely discover this unique and host
|
||||
specific address over [NDP][NDP] for example with:
|
||||
|
||||
```console
|
||||
ip -6 neigh show # also shows fe80::47
|
||||
```
|
||||
|
||||
***This LLA is stable for the host, unless you need to swap that particular network card.***
|
||||
Under this reservation, though, you may use this EUI-64 to wire up a specific
|
||||
(cryptographic) host identity.
|
||||
|
||||
|
||||
[manual]: https://nixos.org/manual/nixos/stable/index.html#sec-installation-partitioning
|
||||
[mDNS]: https://en.wikipedia.org/wiki/Multicast_DNS
|
||||
[NDP]: https://en.wikipedia.org/wiki/Neighbor_Discovery_Protocol
|
||||
[staticLLA]: https://tools.ietf.org/html/rfc7404
|
54
doc/start/from-nixos.md
Normal file
54
doc/start/from-nixos.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
# From NixOS
|
||||
|
||||
## Generate Configuration
|
||||
Assuming you're happy with your existing partition layout, you can generate a
|
||||
basic NixOS configuration for your system using:
|
||||
```sh
|
||||
flk up
|
||||
```
|
||||
|
||||
This will make a new file `hosts/up-$(hostname).nix`, which you can edit to
|
||||
your liking.
|
||||
|
||||
You must then add a host to `nixos.hosts` in flake.nix:
|
||||
```nix
|
||||
{
|
||||
nixos.hosts = {
|
||||
modules = hosts/NixOS.nix;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Make sure your `i18n.defaultLocale` and `time.timeZone` are set properly for
|
||||
your region. Keep in mind that `networking.hostName` will be automatically
|
||||
set to the name of your host;
|
||||
|
||||
Now might be a good time to read the docs on [suites](../concepts/suites.md) and
|
||||
[profiles](../concepts/profiles.md) and add or create any that you need.
|
||||
|
||||
> ##### _Note:_
|
||||
> While the `up` sub-command is provided as a convenience to quickly set up and
|
||||
> install a "fresh" NixOS system on current hardware, committing these files is
|
||||
> discouraged.
|
||||
>
|
||||
> They are placed in the git staging area automatically because they would be
|
||||
> invisible to the flake otherwise, but it is best to move what you need from
|
||||
> them directly into a host module of your own making, and commit that instead.
|
||||
# Installation
|
||||
|
||||
Once you're ready to deploy `hosts/my-host.nix`:
|
||||
```sh
|
||||
flk my-host switch
|
||||
```
|
||||
|
||||
|
||||
This calls `nixos-rebuild` with sudo to build and install your configuration.
|
||||
|
||||
> ##### _Notes:_
|
||||
> - Instead of `switch`, you can pass `build`, `test`, `boot`, etc just as with
|
||||
> `nixos-rebuild`.
|
||||
>
|
||||
> - It is convenient to have the template living at `/etc/nixos` so you can
|
||||
> simply `sudo nixos-rebuild switch` from anywhere on the system, but it is
|
||||
> not required.
|
||||
|
41
doc/start/index.md
Normal file
41
doc/start/index.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Quick Start
|
||||
The only dependency is nix, so make sure you have it [installed][install-nix].
|
||||
|
||||
## Get the Template
|
||||
Here is a snippet that will get you the template without the git history:
|
||||
```sh
|
||||
nix-shell -p cachix --run "cachix use nrdxp"
|
||||
|
||||
nix-shell https://github.com/divnix/devos/archive/core.tar.gz -A shell \
|
||||
--run "flk get core"
|
||||
|
||||
cd flk
|
||||
|
||||
nix-shell
|
||||
|
||||
git init
|
||||
git add .
|
||||
git commit -m init
|
||||
```
|
||||
|
||||
This will place you in a new folder named `flk` with git initialized, and a
|
||||
nix-shell that provides all the dependencies, including the unstable nix
|
||||
version required.
|
||||
|
||||
In addition, the [binary cache](../integrations/cachix.md) is added for faster deployment.
|
||||
|
||||
> ##### _Notes:_
|
||||
> - Flakes ignore files that have not been added to git, so be sure to stage new
|
||||
> files before building the system.
|
||||
> - You can choose to simply clone the repo with git if you want to follow
|
||||
> upstream changes.
|
||||
> - If the `nix-shell -p cachix --run "cachix use nrdxp"` line doesn't work
|
||||
> you can try with sudo: `sudo nix-shell -p cachix --run "cachix use nrdxp"`
|
||||
|
||||
## Next Steps:
|
||||
- [Make installable ISO](./iso.md)
|
||||
- [Bootstrap Host](./bootstrapping.md)
|
||||
- [Already on NixOS](./from-nixos.md)
|
||||
|
||||
|
||||
[install-nix]: https://nixos.org/manual/nix/stable/#sect-multi-user-installation
|
22
doc/start/iso.md
Normal file
22
doc/start/iso.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
# ISO
|
||||
|
||||
Making and writing an installable iso for `hosts/bootstrap.nix` is as simple as:
|
||||
```sh
|
||||
bud build bootstrap bootstrapIso
|
||||
sudo -E $(which bud) burn
|
||||
```
|
||||
|
||||
This works for any host.
|
||||
|
||||
## ISO image nix store & cache
|
||||
|
||||
The iso image holds the store to the live environment and _also_ acts as a binary cache
|
||||
to the installer. To considerably speed up things, the image already includes all flake
|
||||
`inputs` as well as the `devshell` closures.
|
||||
|
||||
While you _could_ provision any machine with a single stick, a custom-made iso for
|
||||
the host you want to install DevOS to, maximises those local cache hits.
|
||||
|
||||
For hosts that don't differ too much, a single usb stick might be ok, whereas when
|
||||
there are bigger differences, a custom-made usb stick will be considerably faster.
|
||||
|
33
doc/tests.md
Normal file
33
doc/tests.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Testing
|
||||
|
||||
Testing is always an important aspect of any software development project, and
|
||||
NixOS offers some incredibly powerful tools to write tests for your
|
||||
configuration, and, optionally, run them in
|
||||
[CI](./integrations/hercules.md).
|
||||
|
||||
## Unit Tests
|
||||
Unit tests can be created from regular derivations, and they can do
|
||||
almost anything you can imagine. By convention, it is best to test your
|
||||
packages during their [check phase][check]. All packages and their tests will
|
||||
be built during CI.
|
||||
|
||||
## Integration Tests
|
||||
All your profiles defined in suites will be tested in a NixOS VM.
|
||||
|
||||
You can write integration tests for one or more NixOS VMs that can,
|
||||
optionally, be networked together, and yes, it's as awesome as it sounds!
|
||||
|
||||
Be sure to use the `mkTest` function from digga, `digga.lib.pkgs-lib.mkTest`
|
||||
which wraps the official [testing-python][testing-python] function to ensure
|
||||
that the system is setup exactly as it is for a bare DevOS system. There are
|
||||
already great resources for learning how to use these tests effectively,
|
||||
including the official [docs][test-doc], a fantastic [blog post][test-blog],
|
||||
and the examples in [nixpkgs][nixos-tests].
|
||||
|
||||
[test-doc]: https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests
|
||||
[test-blog]: https://www.haskellforall.com/2020/11/how-to-use-nixos-for-lightweight.html
|
||||
[default]: https://github.com/divnix/devos/tree/core/tests/default.nix
|
||||
[run-test]: https://github.com/NixOS/nixpkgs/blob/6571462647d7316aff8b8597ecdf5922547bf365/lib/debug.nix#L154-L166
|
||||
[nixos-tests]: https://github.com/NixOS/nixpkgs/tree/master/nixos/tests
|
||||
[testing-python]: https://github.com/NixOS/nixpkgs/tree/master/nixos/lib/testing-python.nix
|
||||
[check]: https://nixos.org/manual/nixpkgs/stable/#ssec-check-phase
|
6
doc/theme/highlight.js
vendored
Normal file
6
doc/theme/highlight.js
vendored
Normal file
File diff suppressed because one or more lines are too long
430
flake.lock
Normal file
430
flake.lock
Normal file
|
@ -0,0 +1,430 @@
|
|||
{
|
||||
"nodes": {
|
||||
"agenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"latest"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1620877075,
|
||||
"narHash": "sha256-XvgTqtmQZHegu9UMDSR50gK5cHEM2gbnRH0qecmdN54=",
|
||||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"rev": "e543aa7d68f222e1e771165da9e9a64b5bf7b3e3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"blank": {
|
||||
"locked": {
|
||||
"lastModified": 1625557891,
|
||||
"narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=",
|
||||
"owner": "divnix",
|
||||
"repo": "blank",
|
||||
"rev": "5a5d2684073d9f563072ed07c871d577a6c614a8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "divnix",
|
||||
"repo": "blank",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"bud": {
|
||||
"inputs": {
|
||||
"devshell": [
|
||||
"digga",
|
||||
"devshell"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixos"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1627855680,
|
||||
"narHash": "sha256-snDOrUp8nth2Vs3GeEXr7Xji+HaHy25htZLNvid/U3I=",
|
||||
"owner": "divnix",
|
||||
"repo": "bud",
|
||||
"rev": "612228a68d404d559405225427a5d8b3cef9d27c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "divnix",
|
||||
"repo": "bud",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"latest"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1622060422,
|
||||
"narHash": "sha256-hPVlvrAyf6zL7tTx0lpK+tMxEfZeMiIZ/A2xaJ41WOY=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "007d700e644ac588ad6668e6439950a5b6e2ff64",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"deploy": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": [
|
||||
"digga",
|
||||
"nixpkgs"
|
||||
],
|
||||
"utils": [
|
||||
"digga",
|
||||
"flake-utils"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1628068208,
|
||||
"narHash": "sha256-akJBkj6os4bjO1drhketJvXNC21yPuy4ufL2pyius4M=",
|
||||
"owner": "serokell",
|
||||
"repo": "deploy-rs",
|
||||
"rev": "d72174307d5b88ec24cc2e69e875228fe3d642ed",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "serokell",
|
||||
"repo": "deploy-rs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"devshell": {
|
||||
"locked": {
|
||||
"lastModified": 1625086391,
|
||||
"narHash": "sha256-IpNPv1v8s4L3CoxhwcgZIitGpcrnNgnj09X7TA0QV3k=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "4b5ac7cf7d9a1cc60b965bb51b59922f2210cbc7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"digga": {
|
||||
"inputs": {
|
||||
"blank": "blank",
|
||||
"deploy": "deploy",
|
||||
"devshell": "devshell",
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-utils-plus": "flake-utils-plus",
|
||||
"home-manager": [
|
||||
"home"
|
||||
],
|
||||
"nixlib": [
|
||||
"nixos"
|
||||
],
|
||||
"nixos-generators": "nixos-generators",
|
||||
"nixpkgs": [
|
||||
"nixos"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1628211944,
|
||||
"narHash": "sha256-2q1dNUzitVd0JNRHYTubbyb8ks3fL9hPJOvQgofxELE=",
|
||||
"owner": "divnix",
|
||||
"repo": "digga",
|
||||
"rev": "760bb9c29063258ba547145de0ab96acd7eba4c0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "divnix",
|
||||
"repo": "digga",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1606424373,
|
||||
"narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1623875721,
|
||||
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils-plus": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"digga",
|
||||
"flake-utils"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1627071952,
|
||||
"narHash": "sha256-FhE0KOuI9Kl4eyGJXu4bh9fBP2hbxjnD1DlKHljCcYs=",
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "flake-utils-plus",
|
||||
"rev": "51a82925db31073bc4822c9b538a0a3ebf1134b2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"ref": "staging",
|
||||
"repo": "flake-utils-plus",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixos"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1624228557,
|
||||
"narHash": "sha256-wwOqe73BsrXfRv1PhyXQFNC8iTET50KvE/HitdkRgxs=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "35a24648d155843a4d162de98c17b1afd5db51e4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-21.05",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"latest": {
|
||||
"locked": {
|
||||
"lastModified": 1627942574,
|
||||
"narHash": "sha256-guUcGRWvY2mfiVSet2x/zeHIyflm2wgglj0ldg0mMio=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c464dc811babfe316ed4ab7bbc12351122e69dd7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"digga",
|
||||
"deploy",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1622810282,
|
||||
"narHash": "sha256-4wmvM3/xfD0hCdNDIXVzRMfL4yB1J+DjH6Zte2xbAxk=",
|
||||
"owner": "nmattia",
|
||||
"repo": "naersk",
|
||||
"rev": "e8061169e1495871b56be97c5c51d310fae01374",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nmattia",
|
||||
"ref": "master",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"naersk_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"latest"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1623927034,
|
||||
"narHash": "sha256-sGxlmfp5eXL5sAMNqHSb04Zq6gPl+JeltIZ226OYN0w=",
|
||||
"owner": "nmattia",
|
||||
"repo": "naersk",
|
||||
"rev": "e09c320446c5c2516d430803f7b19f5833781337",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nmattia",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos": {
|
||||
"locked": {
|
||||
"lastModified": 1628203131,
|
||||
"narHash": "sha256-jQgXeJ9NQQS0Eobb/qQOvS+RRULkqRikAeXkkFKOPDA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "178da37860823d35e801c7df2f73d7866d3d598a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "release-21.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-generators": {
|
||||
"inputs": {
|
||||
"nixlib": [
|
||||
"digga",
|
||||
"nixlib"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"digga",
|
||||
"blank"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1624973746,
|
||||
"narHash": "sha256-11JbJRduNwyf556gndGErR5/12ceyHOHBfEuha5Vws4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-generators",
|
||||
"rev": "022ef440af8dc237ab1f59fa363cb1e25783ec3e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-generators",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1625333638,
|
||||
"narHash": "sha256-M6J9RN60XJyv6nUfDFCwnz5aVjhe8+GJnV8Q9VpdQQQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "41775780a0b6b32b3d32dcc32bb9bc6df809062d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"repo": "nixos-hardware",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1626378135,
|
||||
"narHash": "sha256-koC6DBYmLCrgXA+AMHVaODf1uHYPmvcFygHfy3eg6vI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "00c2ec8f0bbdf0cfb2135bde55fbae5d6b64aa6d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nur",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nvfetcher": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"digga",
|
||||
"deploy",
|
||||
"flake-compat"
|
||||
],
|
||||
"flake-utils": [
|
||||
"digga",
|
||||
"flake-utils-plus",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"latest"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1627523399,
|
||||
"narHash": "sha256-j9CgnUQpWcb8OB4LRzPW8BdxvmoROJptgptDlPA8Heo=",
|
||||
"owner": "berberman",
|
||||
"repo": "nvfetcher",
|
||||
"rev": "fb8f2cc770ad3dd3e29d7ba3004692d4d53fba9b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "berberman",
|
||||
"repo": "nvfetcher",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"agenix": "agenix",
|
||||
"blank": [
|
||||
"digga",
|
||||
"blank"
|
||||
],
|
||||
"bud": "bud",
|
||||
"darwin": "darwin",
|
||||
"deploy": [
|
||||
"digga",
|
||||
"deploy"
|
||||
],
|
||||
"digga": "digga",
|
||||
"flake-utils": [
|
||||
"digga",
|
||||
"flake-utils"
|
||||
],
|
||||
"flake-utils-plus": [
|
||||
"digga",
|
||||
"flake-utils-plus"
|
||||
],
|
||||
"home": "home",
|
||||
"latest": "latest",
|
||||
"naersk": "naersk_2",
|
||||
"nixlib": [
|
||||
"digga",
|
||||
"nixlib"
|
||||
],
|
||||
"nixos": "nixos",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": [
|
||||
"nixos"
|
||||
],
|
||||
"nur": "nur",
|
||||
"nvfetcher": "nvfetcher"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
158
flake.nix
Normal file
158
flake.nix
Normal file
|
@ -0,0 +1,158 @@
|
|||
{
|
||||
description = "A highly structured configuration database.";
|
||||
|
||||
nixConfig.extra-experimental-features = "nix-command flakes ca-references";
|
||||
nixConfig.extra-substituters = "https://nrdxp.cachix.org https://nix-community.cachix.org";
|
||||
nixConfig.extra-trusted-public-keys = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
|
||||
|
||||
inputs =
|
||||
{
|
||||
nixos.url = "github:nixos/nixpkgs/release-21.05";
|
||||
latest.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
digga.url = "github:divnix/digga";
|
||||
digga.inputs.nixpkgs.follows = "nixos";
|
||||
digga.inputs.nixlib.follows = "nixos";
|
||||
digga.inputs.home-manager.follows = "home";
|
||||
|
||||
bud.url = "github:divnix/bud";
|
||||
bud.inputs.nixpkgs.follows = "nixos";
|
||||
bud.inputs.devshell.follows = "digga/devshell";
|
||||
|
||||
home.url = "github:nix-community/home-manager/release-21.05";
|
||||
home.inputs.nixpkgs.follows = "nixos";
|
||||
|
||||
darwin.url = "github:LnL7/nix-darwin";
|
||||
darwin.inputs.nixpkgs.follows = "latest";
|
||||
|
||||
deploy.follows = "digga/deploy";
|
||||
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
agenix.inputs.nixpkgs.follows = "latest";
|
||||
|
||||
nvfetcher.url = "github:berberman/nvfetcher";
|
||||
nvfetcher.inputs.nixpkgs.follows = "latest";
|
||||
nvfetcher.inputs.flake-compat.follows = "digga/deploy/flake-compat";
|
||||
nvfetcher.inputs.flake-utils.follows = "digga/flake-utils-plus/flake-utils";
|
||||
|
||||
naersk.url = "github:nmattia/naersk";
|
||||
naersk.inputs.nixpkgs.follows = "latest";
|
||||
|
||||
nixos-hardware.url = "github:nixos/nixos-hardware";
|
||||
|
||||
# start ANTI CORRUPTION LAYER
|
||||
# remove after https://github.com/NixOS/nix/pull/4641
|
||||
nixpkgs.follows = "nixos";
|
||||
nixlib.follows = "digga/nixlib";
|
||||
blank.follows = "digga/blank";
|
||||
flake-utils-plus.follows = "digga/flake-utils-plus";
|
||||
flake-utils.follows = "digga/flake-utils";
|
||||
# end ANTI CORRUPTION LAYER
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, digga
|
||||
, bud
|
||||
, nixos
|
||||
, home
|
||||
, nixos-hardware
|
||||
, nur
|
||||
, agenix
|
||||
, nvfetcher
|
||||
, deploy
|
||||
, ...
|
||||
} @ inputs:
|
||||
digga.lib.mkFlake
|
||||
{
|
||||
inherit self inputs;
|
||||
|
||||
channelsConfig = { allowUnfree = true; };
|
||||
|
||||
channels = {
|
||||
nixos = {
|
||||
imports = [ (digga.lib.importOverlays ./overlays) ];
|
||||
overlays = [
|
||||
digga.overlays.patchedNix
|
||||
nur.overlay
|
||||
agenix.overlay
|
||||
nvfetcher.overlay
|
||||
deploy.overlay
|
||||
./pkgs/default.nix
|
||||
];
|
||||
};
|
||||
latest = { };
|
||||
};
|
||||
|
||||
lib = import ./lib { lib = digga.lib // nixos.lib; };
|
||||
|
||||
sharedOverlays = [
|
||||
(final: prev: {
|
||||
__dontExport = true;
|
||||
lib = prev.lib.extend (lfinal: lprev: {
|
||||
our = self.lib;
|
||||
});
|
||||
})
|
||||
];
|
||||
|
||||
nixos = {
|
||||
hostDefaults = {
|
||||
system = "x86_64-linux";
|
||||
channelName = "nixos";
|
||||
imports = [ (digga.lib.importModules ./modules) ];
|
||||
externalModules = [
|
||||
{ lib.our = self.lib; }
|
||||
digga.nixosModules.bootstrapIso
|
||||
digga.nixosModules.nixConfig
|
||||
home.nixosModules.home-manager
|
||||
agenix.nixosModules.age
|
||||
bud.nixosModules.bud
|
||||
];
|
||||
};
|
||||
|
||||
imports = [ (digga.lib.importHosts ./hosts) ];
|
||||
hosts = {
|
||||
/* set host specific properties here */
|
||||
NixOS = { };
|
||||
};
|
||||
importables = rec {
|
||||
profiles = digga.lib.rakeLeaves ./profiles // {
|
||||
users = digga.lib.rakeLeaves ./users;
|
||||
};
|
||||
suites = with profiles; rec {
|
||||
base = [ core users.nixos users.root ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home = {
|
||||
imports = [ (digga.lib.importModules ./users/modules) ];
|
||||
externalModules = [ ];
|
||||
importables = rec {
|
||||
profiles = digga.lib.rakeLeaves ./users/profiles;
|
||||
suites = with profiles; rec {
|
||||
base = [ direnv git ];
|
||||
};
|
||||
};
|
||||
users = {
|
||||
nixos = { suites, ... }: { imports = suites.base; };
|
||||
}; # digga.lib.importers.rakeLeaves ./users/hm;
|
||||
};
|
||||
|
||||
devshell = ./shell;
|
||||
|
||||
homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations;
|
||||
|
||||
deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { };
|
||||
|
||||
defaultTemplate = self.templates.bud;
|
||||
templates.bud.path = ./.;
|
||||
templates.bud.description = "bud template";
|
||||
|
||||
}
|
||||
//
|
||||
{
|
||||
budModules = { devos = import ./bud; };
|
||||
}
|
||||
;
|
||||
}
|
12
hosts/NixOS.nix
Normal file
12
hosts/NixOS.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ suites, ... }:
|
||||
{
|
||||
### root password is empty by default ###
|
||||
imports = suites.base;
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };
|
||||
}
|
18
hosts/bootstrap.nix
Normal file
18
hosts/bootstrap.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ profiles, ... }:
|
||||
{
|
||||
# build with: `bud build bootstrap bootstrapIso`
|
||||
# reachable on the local link via ssh root@fe80::47%eno1
|
||||
# where 'eno1' is replaced by your own machine's network
|
||||
# interface that has the local link to the target machine
|
||||
imports = [
|
||||
# profiles.networking
|
||||
profiles.core
|
||||
profiles.users.root # make sure to configure ssh keys
|
||||
profiles.users.nixos
|
||||
];
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
|
||||
# will be overridden by the bootstrapIso instrumentation
|
||||
fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };
|
||||
}
|
14
lib/compat/default.nix
Normal file
14
lib/compat/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
let
|
||||
rev = "e7e5d481a0e15dcd459396e55327749989e04ce0";
|
||||
flake = (import
|
||||
(
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
|
||||
sha256 = "0zd3x46fswh5n6faq4x2kkpy6p3c6j593xbdlbsl40ppkclwc80x";
|
||||
}
|
||||
)
|
||||
{
|
||||
src = ../../.;
|
||||
});
|
||||
in
|
||||
flake
|
10
lib/compat/nixos/default.nix
Normal file
10
lib/compat/nixos/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
let
|
||||
inherit (default.inputs.nixos) lib;
|
||||
|
||||
host = configs.${hostname} or configs.NixOS;
|
||||
configs = default.nixosConfigurations;
|
||||
default = (import ../.).defaultNix;
|
||||
hostname = lib.fileContents /etc/hostname;
|
||||
in
|
||||
host
|
2
lib/default.nix
Normal file
2
lib/default.nix
Normal file
|
@ -0,0 +1,2 @@
|
|||
{ lib }:
|
||||
lib.makeExtensible (self: { })
|
|
@ -1,74 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
./taskd.nix
|
||||
./nextcloud.nix
|
||||
./networking.nix
|
||||
# ./wireguard.nix
|
||||
# ./shiori.nix
|
||||
./shaarli.nix
|
||||
# ./shaarli-tokudan.nix
|
||||
# ./mod-wallabag.nix
|
||||
# ./pkg-wallabag.nix
|
||||
./navidrome.nix
|
||||
./pkg-navidrome.nix
|
||||
# ./wallabag.nix
|
||||
./headphones.nix
|
||||
./dns.nix
|
||||
./backup.nix
|
||||
./monitoring.nix
|
||||
];
|
||||
|
||||
boot.loader.grub.devices = [ "/dev/sda" ];
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.version = 2;
|
||||
boot.loader.grub.enableCryptodisk = true;
|
||||
boot.loader.supportsInitrdSecrets = true;
|
||||
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||
boot.initrd.availableKernelModules = ["virtio-pci"];
|
||||
boot.initrd.network = {
|
||||
enable = true;
|
||||
ssh = {
|
||||
enable = true;
|
||||
port = 2222;
|
||||
authorizedKeys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKN8/SH55DBiwVoSnTU8k2Pen+wmovL9QaMyehxGEsJJv/8fzwsswGalD4C/4O51LOvdu4UKkZW5hG02uVSK+58p3UV3pOPyoqsu/aDeIsWsqmTeTzUrBIWOlNzcDKnohLz2oGC5YO+wyTJ9Iteq6aGJDjErsW7sG3h5lXCs551EmJNNGhtBQaaoytMNnWqSdlVjDNCijurH7WUpp40U/RjEp532l4rX6eIIj3jBKEFbhZkFSSjqbj4xM4SyFt+Jmigb1RMjsQjmpfY1vDtM84RcYfpTUte/T5w2dkD5H6kccmWnwKSJpm9wXfx4E7lR9APdUGnau2U1+XxiD3ytGl anish@box
|
||||
"];
|
||||
hostKeys = [ "/host_ecdsa_key" ];
|
||||
};
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices = {
|
||||
"enc-pv" = {
|
||||
name = "enc-pv";
|
||||
preLVM = true;
|
||||
device = "/dev/disk/by-uuid/425cc402-9221-474f-aaf1-10ac7cd4c93c";
|
||||
allowDiscards = true;
|
||||
};
|
||||
};
|
||||
|
||||
boot.initrd.secrets = {
|
||||
"/host_ecdsa_key" = "/host_ecdsa_key";
|
||||
};
|
||||
|
||||
|
||||
boot.cleanTmpDir = true;
|
||||
boot.kernelModules = [ "dm-snapshot" ];
|
||||
|
||||
users.users.anish = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ];
|
||||
hashedPassword = "MO0Pbd2O4eIlA";
|
||||
openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKN8/SH55DBiwVoSnTU8k2Pen+wmovL9QaMyehxGEsJJv/8fzwsswGalD4C/4O51LOvdu4UKkZW5hG02uVSK+58p3UV3pOPyoqsu/aDeIsWsqmTeTzUrBIWOlNzcDKnohLz2oGC5YO+wyTJ9Iteq6aGJDjErsW7sG3h5lXCs551EmJNNGhtBQaaoytMNnWqSdlVjDNCijurH7WUpp40U/RjEp532l4rX6eIIj3jBKEFbhZkFSSjqbj4xM4SyFt+Jmigb1RMjsQjmpfY1vDtM84RcYfpTUte/T5w2dkD5H6kccmWnwKSJpm9wXfx4E7lR9APdUGnau2U1+XxiD3ytGl anish@box ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDM8kTdMGGmr6mv/zv+K9qVjhzqwivyyN5IV04R7/kcWKw1c6ZEzzqqmsnJ/hci6IIxZ/VEUzMhYz0iBCL0wJHHMxYoNCgISWePtDlVJdyrzm9OWjJNcRStZBW3XcY9dELJsCVcQ4LAVYE4vA+MdmbwM2FZgJhAH6qUzujpfNrj/YIVG7MTN6tbUd63uZF57F43c8WUjgRJx2o7Wl9bSe6v3PZ4fAgEO+wQPso+W+pEXLZ3hBNrHdybwdoGvG9tHlBDbLid11BxtpzmwR9CydDfpbyOXB2+tJkkNXhsHB22mN/2+vGWYhDKYPTFqbDW7McDfQChySyYDdZWmg5WHIGz anish@curve" ];
|
||||
};
|
||||
|
||||
users.users.root.initialHashedPassword = "";
|
||||
services.openssh.permitRootLogin = "prohibit-password";
|
||||
networking.hostName = "bowl";
|
||||
services.openssh.enable = true;
|
||||
services.logind.lidSwitch = "ignore";
|
||||
system.stateVersion = "20.09";
|
||||
time.timeZone = "Australia/Brisbane";
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
|
||||
imports = [
|
||||
# install software
|
||||
./common.nix
|
||||
];
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
displayManager.gdm.enable = true;
|
||||
desktopManager.gnome3.enable = true;
|
||||
};
|
||||
|
||||
# task whisperer broken
|
||||
nixpkgs.config.allowBroken = true;
|
||||
|
||||
# virtual box
|
||||
virtualisation.virtualbox.host.enable = true;
|
||||
|
||||
# ErgoDox Firmware (doesn't compile)
|
||||
# environment.systemPackages = with pkgs; [
|
||||
# qmk_firmware
|
||||
# ];
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
./wireguard.nix
|
||||
./matrix.nix
|
||||
];
|
||||
|
||||
# Use the GRUB 2 boot loader.
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.version = 2;
|
||||
boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only
|
||||
|
||||
networking.hostName = "helix"; # Define your hostname.
|
||||
|
||||
networking.useDHCP = false;
|
||||
networking.interfaces.ens3.useDHCP = true;
|
||||
|
||||
# Configure network proxy if necessary
|
||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
#services.openssh.passwordAuthentication = false;
|
||||
services.openssh.permitRootLogin = "no";
|
||||
|
||||
# Open ports in the firewall.
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
# networking.firewall.enable = false;
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.anish = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDM8kTdMGGmr6mv/zv+K9qVjhzqwivyyN5IV04R7/kcWKw1c6ZEzzqqmsnJ/hci6IIxZ/VEUzMhYz0iBCL0wJHHMxYoNCgISWePtDlVJdyrzm9OWjJNcRStZBW3XcY9dELJsCVcQ4LAVYE4vA+MdmbwM2FZgJhAH6qUzujpfNrj/YIVG7MTN6tbUd63uZF57F43c8WUjgRJx2o7Wl9bSe6v3PZ4fAgEO+wQPso+W+pEXLZ3hBNrHdybwdoGvG9tHlBDbLid11BxtpzmwR9CydDfpbyOXB2+tJkkNXhsHB22mN/2+vGWYhDKYPTFqbDW7McDfQChySyYDdZWmg5WHIGz anish@curve"
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeWQsf9rbE+KBrWLkLkg1PMKx0jPfDP8xyv+XtddIQzAskRTN+JSSQp1GpoRgfQij7bx6f6DfjkwSQK5NWDQNQ+klGhcdEwEdptWUzpRAvKHMImjyIwFHmRKKEgcfH8+DSHVM93nRSQKrLezX4PzPkHF9f3TLxFdGeQDeY0J2oP2Oa97hRtuTJZW9BwUojyvDYUbg7F3fxf+pdFCvIAFaayiLkhOYdTXnjLt1Ks6NOhSzM78ZibHv4pFYI9r6dhflkFP/SzyLeSSm1aVAtxqE7vF5HnnORAg0byDsiOv/9RXxiDx7gkAAw3xENDSpp9TRj54M7iz1OSsRMhmD6orHjZFIRejlE4DIn+PBPm3PH+U5ILKTogE6n5MfPT28V0QdtHuqq3b5tSWiDcFpnjxbIUmEIo5hLzMR0tXZoNLQhBCSNfxjE8CYzpk7mHbvhSs2GPfG+NI1vvldbw2EF8beJFQHNYTqJw8y7p8RXpCwZqqpSitJX6v9DiYdLVG1hWvE= nix-on-droid@localhost"
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKN8/SH55DBiwVoSnTU8k2Pen+wmovL9QaMyehxGEsJJv/8fzwsswGalD4C/4O51LOvdu4UKkZW5hG02uVSK+58p3UV3pOPyoqsu/aDeIsWsqmTeTzUrBIWOlNzcDKnohLz2oGC5YO+wyTJ9Iteq6aGJDjErsW7sG3h5lXCs551EmJNNGhtBQaaoytMNnWqSdlVjDNCijurH7WUpp40U/RjEp532l4rX6eIIj3jBKEFbhZkFSSjqbj4xM4SyFt+Jmigb1RMjsQjmpfY1vDtM84RcYfpTUte/T5w2dkD5H6kccmWnwKSJpm9wXfx4E7lR9APdUGnau2U1+XxiD3ytGl anish@box" ];
|
||||
};
|
||||
|
||||
# This value determines the NixOS release with which your system is to be
|
||||
# compatible, in order to avoid breaking some software such as database
|
||||
# servers. You should change this only after NixOS release notes say you
|
||||
# should.
|
||||
system.stateVersion = "19.09"; # Did you read the comment?
|
||||
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
# Assumes the remote borg backup server has already been initialized
|
||||
# borg init --encryption-key=repokey-blake2 -rsh 'ssh -i /run/keys/id_ed25519_borgbase' 20779@hk-s020.rsync.net:<borg-archive>
|
||||
services.borgbackup.jobs = {
|
||||
backupTaskwarriorRsync = {
|
||||
paths = [ "/var/lib/taskserver" ];
|
||||
doInit = true;
|
||||
repo = "20779@hk-s020.rsync.net:taskwarrior" ;
|
||||
encryption = {
|
||||
mode = "repokey-blake2";
|
||||
passCommand = "cat /run/keys/rsync";
|
||||
};
|
||||
environment = { BORG_RSH = "ssh -i /run/keys/id_ed25519_borgbase"; };
|
||||
compression = "auto,lzma";
|
||||
startAt = "weekly";
|
||||
extraArgs = "--remote-path=borg1";
|
||||
};
|
||||
};
|
||||
services.borgbackup.jobs = {
|
||||
backupShaarliRsync = {
|
||||
paths = [ "/var/www/shaarli-config/data/datastore.php" "/var/www/shaarli-config/config" "/var/www/shaarli-config/.json.config" ];
|
||||
doInit = true;
|
||||
repo = "20779@hk-s020.rsync.net:shaarli" ;
|
||||
encryption = {
|
||||
mode = "repokey-blake2";
|
||||
passCommand = "cat /run/keys/rsync";
|
||||
};
|
||||
environment = { BORG_RSH = "ssh -i /run/keys/id_ed25519_borgbase"; };
|
||||
compression = "auto,lzma";
|
||||
startAt = "weekly";
|
||||
extraArgs = "--remote-path=borg1";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./nvim.nix
|
||||
# ./unstable.nix
|
||||
];
|
||||
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
htop
|
||||
iftop
|
||||
wget
|
||||
curl
|
||||
exa
|
||||
bat
|
||||
fd
|
||||
ag
|
||||
tcpdump
|
||||
whois
|
||||
mtr
|
||||
file
|
||||
lsof
|
||||
atool
|
||||
inotify-tools
|
||||
strace
|
||||
zip
|
||||
unzip
|
||||
rsync
|
||||
tmux
|
||||
pwgen
|
||||
glow
|
||||
gitAndTools.gitFull
|
||||
#neovim defined in ./nvim.nix
|
||||
wofi
|
||||
firefox
|
||||
fractal
|
||||
pinentry_gnome
|
||||
pass
|
||||
gcc
|
||||
less
|
||||
mpv
|
||||
zathura
|
||||
#qmk_firmware
|
||||
python3
|
||||
gdb
|
||||
vcv-rack
|
||||
#xdotool
|
||||
#neofetch
|
||||
#calibre
|
||||
#openvpn
|
||||
gimp
|
||||
xxd
|
||||
tilix
|
||||
kitty
|
||||
taskwarrior
|
||||
gnupg
|
||||
openjdk
|
||||
glslviewer
|
||||
filezilla
|
||||
signal-desktop
|
||||
wire-desktop
|
||||
tdesktop
|
||||
feedreader
|
||||
newsflash
|
||||
syncthing
|
||||
dijo
|
||||
#kdeconnect
|
||||
#ssb-patchwork
|
||||
gnome3.gnome-tweaks
|
||||
gnome3.pomodoro
|
||||
gnomeExtensions.gsconnect
|
||||
gnomeExtensions.taskwhisperer
|
||||
#gnome3.networkmanager-openvpn
|
||||
#python3Packages.youtube-dl
|
||||
appimage-run
|
||||
home-manager
|
||||
libreoffice
|
||||
fontconfig
|
||||
hugo
|
||||
#processing
|
||||
#nextcloud-client
|
||||
zsh-powerlevel10k
|
||||
powerline-fonts
|
||||
supercollider
|
||||
haskellPackages.tidal
|
||||
# vim-zettel
|
||||
pandoc
|
||||
];
|
||||
|
||||
programs.bash.enableCompletion = true;
|
||||
|
||||
# needed for vcv-rack
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
system.copySystemConfiguration = true;
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
openDefaultPorts = true;
|
||||
systemService = true;
|
||||
user = "anish";
|
||||
dataDir = "/home/anish/usr/syncthing";
|
||||
};
|
||||
|
||||
#zsh powerlevel10k
|
||||
programs.zsh.enable = true;
|
||||
programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
|
||||
users.users.anish.shell = pkgs.zsh;
|
||||
|
||||
#android
|
||||
programs.adb.enable = true;
|
||||
users.users.anish.extraGroups = ["adbusers"];
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
services.dnsmasq.enable = true;
|
||||
services.dnsmasq.extraConfig = ''
|
||||
address=/.mossnet.lan/192.168.1.6
|
||||
dhcp-range=192.168.1.1,proxy
|
||||
'';
|
||||
services.dnsmasq.servers = [ "45.90.30.49" "45.90.28.49" "1.1.1.1" "8.8.8.8" ];
|
||||
networking.firewall.allowedTCPPorts = [ 53 ];
|
||||
networking.firewall.allowedUDPPorts = [ 53 ];
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{config, lib, pkgs, ... }:
|
||||
{
|
||||
services.headphones = {
|
||||
enable = true;
|
||||
host = "192.168.1.6";
|
||||
port = 8181;
|
||||
user = "headphones";
|
||||
group = "headphones";
|
||||
dataDir = "/data/downloaded";
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 8181 ];
|
||||
}
|
11
modules/hm-system-defaults.nix
Normal file
11
modules/hm-system-defaults.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ config, ... }: {
|
||||
home-manager.sharedModules = [
|
||||
{
|
||||
home.sessionVariables = {
|
||||
inherit (config.environment.sessionVariables) NIX_PATH;
|
||||
};
|
||||
xdg.configFile."nix/registry.json".text =
|
||||
config.environment.etc."nix/registry.json".text;
|
||||
}
|
||||
];
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
dataDir = "/var/lib/matrix-appservice-slack";
|
||||
registrationFile = "${dataDir}/slack-registration.yaml";
|
||||
#appDir = "${pkgs.matrix-appservice-slack}/${pkgs.matrix-appservice-slack.passthru.nodeAppDir}";
|
||||
cfg = config.services.matrix-appservice-slack;
|
||||
# TODO: switch to configGen.json once RFC42 is implemented
|
||||
settingsFile = pkgs.writeText "matrix-appservice-slack-settings.json" (builtins.toJSON cfg.settings);
|
||||
|
||||
in {
|
||||
options = {
|
||||
services.matrix-appservice-slack = {
|
||||
enable = mkEnableOption "a bridge between Matrix and Slack";
|
||||
|
||||
settings = mkOption rec {
|
||||
# TODO: switch to types.config.json as prescribed by RFC42 once it's implemented
|
||||
type = types.attrs;
|
||||
apply = recursiveUpdate default;
|
||||
default = {
|
||||
# empty values necessary for registration file generation
|
||||
# actual values defined in environmentFile
|
||||
auth = {
|
||||
clientID = "";
|
||||
botToken = "";
|
||||
};
|
||||
};
|
||||
example = literalExample ''
|
||||
{
|
||||
bridge = {
|
||||
domain = "public-domain.tld";
|
||||
homeserverUrl = "http://public-domain.tld:8008";
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
<filename>config.yaml</filename> configuration as a Nix attribute set.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Configuration options should match those described in
|
||||
<link xlink:href="https://github.com/Half-Shot/matrix-appservice-discord/blob/master/config/config.sample.yaml">
|
||||
config.sample.yaml</link>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<option>config.bridge.domain</option> and <option>config.bridge.homeserverUrl</option>
|
||||
should be set to match the public host name of the Matrix homeserver for webhooks and avatars to work.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Secret tokens should be specified using <option>environmentFile</option>
|
||||
instead of this world-readable attribute set.
|
||||
'';
|
||||
};
|
||||
|
||||
environmentFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
File containing environment variables to be passed to the matrix-appservice-discord service,
|
||||
in which secret tokens can be specified securely by defining values for
|
||||
<literal>APPSERVICE_SLACK_AUTH_CLIENT_I_D</literal> and
|
||||
<literal>APPSERVICE_SLACK_AUTH_BOT_TOKEN</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
url = mkOption {
|
||||
type = types.str;
|
||||
default = "http://localhost:${toString cfg.port}";
|
||||
description = ''
|
||||
The URL where the application service is listening for HS requests.
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 9898; # from https://github.com/matrix-org/matrix-appservice-slack/blob/develop/config/config.sample.yaml#L70
|
||||
description = ''
|
||||
Port number on which the bridge should listen for internal communication with the Matrix homeserver.
|
||||
'';
|
||||
};
|
||||
|
||||
localpart = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
The user_id localpart to assign to the AS.
|
||||
'';
|
||||
};
|
||||
|
||||
serviceDependencies = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = optional config.services.matrix-synapse.enable "matrix-synapse.service";
|
||||
description = ''
|
||||
List of Systemd services to require and wait for when starting the application service,
|
||||
such as the Matrix homeserver if it's running on the same host.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.matrix-appservice-slack = {
|
||||
description = "A bridge between Matrix and Slack.";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ] ++ cfg.serviceDependencies;
|
||||
after = [ "network-online.target" ] ++ cfg.serviceDependencies;
|
||||
|
||||
preStart = ''
|
||||
if [ ! -f '${registrationFile}' ]; then
|
||||
${pkgs.matrix-appservice-slack}/bin/matrix-appservice-slack \
|
||||
--generate-registration \
|
||||
--url=${escapeShellArg cfg.url} \
|
||||
${optionalString (cfg.localpart != null) "--localpart=${escapeShellArg cfg.localpart}"} \
|
||||
--config='${settingsFile}' \
|
||||
--file='${registrationFile}'
|
||||
fi
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "always";
|
||||
|
||||
ProtectSystem = "strict";
|
||||
ProtectHome = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectControlGroups = true;
|
||||
|
||||
DynamicUser = true;
|
||||
PrivateTmp = true;
|
||||
#WorkingDirectory = appDir;
|
||||
StateDirectory = baseNameOf dataDir;
|
||||
UMask = 0027;
|
||||
EnvironmentFile = cfg.environmentFile;
|
||||
|
||||
ExecStart = ''
|
||||
${pkgs.matrix-appservice-slack}/bin/matrix-appservice-slack \
|
||||
--file='${registrationFile}' \
|
||||
--config='${settingsFile}' \
|
||||
--port='${toString cfg.port}'
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = with maintainers; [ chickensoupandrice ];
|
||||
}
|
||||
|
|
@ -1,258 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./matrix-slack.nix ./mautrix-whatsapp.nix ];
|
||||
security.acme.email = "anish+acme@lakhwara.com";
|
||||
security.acme.acceptTerms = true;
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
app_service_config_files = [
|
||||
# # The registration file is automatically generated after starting the appservice for the first time.
|
||||
# # cp /var/lib/matrix-appservice-discord/discord-registration.yaml /var/lib/matrix-synapse/
|
||||
# # chown matrix-synapse:matrix-synapse /var/lib/matrix-synapse/discord-registration.yaml
|
||||
# "/var/lib/matrix-synapse/discord-registration.yaml"
|
||||
"/var/lib/matrix-synapse/telegram-registration.yaml"
|
||||
"/var/lib/matrix-synapse/slack-registration.yaml"
|
||||
"/var/lib/matrix-synapse/whatsapp-registration.yaml"
|
||||
];
|
||||
server_name = "sealight.xyz";
|
||||
registration_shared_secret = "hD9HQGTTDxp0mQsQ5JDsfudWMDiubmZENOgPchIvfBvUlPxlvQSvjoO4wn2L1seU";
|
||||
enable_metrics = true;
|
||||
enable_registration = true;
|
||||
database_type = "psycopg2";
|
||||
database_args = {
|
||||
database = "matrix-synapse";
|
||||
};
|
||||
listeners = [
|
||||
{
|
||||
port = 8448;
|
||||
tls = false;
|
||||
resources = [
|
||||
{
|
||||
compress = true;
|
||||
names = ["client" "federation"];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
extraConfig = ''
|
||||
max_upload_size: "50M"
|
||||
'';
|
||||
};
|
||||
|
||||
services.mautrix-telegram = {
|
||||
enable = true;
|
||||
environmentFile = /etc/secrets/telegram.env; # file containing the appservice and telegram tokens
|
||||
# The appservice is pre-configured to use SQLite by default. It's also possible to use PostgreSQL.
|
||||
settings = {
|
||||
homeserver = {
|
||||
address = "https://chat.sealight.xyz";
|
||||
domain = "sealight.xyz";
|
||||
};
|
||||
appservice = {
|
||||
provisioning.enabled = false;
|
||||
id = "telegram";
|
||||
public = {
|
||||
enabled = false;
|
||||
prefix = "/public";
|
||||
external = "https://chat.sealight.xyz/public";
|
||||
};
|
||||
# The service uses SQLite by default, but it's also possible to use PostgreSQL instead:
|
||||
#database = "postgresql:///mautrix-telegram?host=/run/postgresql";
|
||||
};
|
||||
bridge = {
|
||||
relaybot.authless_portals = false;
|
||||
permissions = {
|
||||
"@aynish:sealight.xyz" = "admin";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.mautrix-whatsapp = {
|
||||
enable = true;
|
||||
# The appservice is pre-configured to use SQLite by default. It's also possible to use PostgreSQL.
|
||||
configOptions = {
|
||||
homeserver = {
|
||||
address = "https://chat.sealight.xyz";
|
||||
domain = "sealight.xyz";
|
||||
};
|
||||
appservice = {
|
||||
id = "whatsapp";
|
||||
address = http://localhost:9897;
|
||||
hostname = "0.0.0.0";
|
||||
port = 9897;
|
||||
database = {
|
||||
type = "sqlite3";
|
||||
uri = "/var/lib/mautrix-whatsapp/mautrix-whatsapp.db";
|
||||
};
|
||||
state_store_path = "/var/lib/mautrix-whatsapp/mx-state.json";
|
||||
bot = {
|
||||
username = "whatsappbot";
|
||||
displayname = "WhatsApp bridge bot";
|
||||
avatar = "mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr";
|
||||
};
|
||||
as_token = "";
|
||||
hs_token = "";
|
||||
};
|
||||
bridge = {
|
||||
username_template = "whatsapp_{{.}}";
|
||||
displayname_template = "{{if .Notify}}{{.Notify}}{{else}}{{.Jid}}{{end}} (WA)";
|
||||
command_prefix = "!wa";
|
||||
permissions = {
|
||||
"@aynish:sealight.xyz" = 100;
|
||||
};
|
||||
};
|
||||
logging = {
|
||||
directory = "/var/lib/mautrix-whatsapp/logs";
|
||||
file_name_format = "{{.Date}}-{{.Index}}.log";
|
||||
file_date_format = "\"2006-01-02\"";
|
||||
file_mode = 384;
|
||||
timestamp_format = "Jan _2, 2006 15:04:05";
|
||||
print_level = "debug";
|
||||
};
|
||||
metrics = {
|
||||
enabled = true;
|
||||
listen = "http://localhost:5070";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.matrix-appservice-slack = {
|
||||
enable = true;
|
||||
#environmentFile = /etc/secrets/matrix-appservice-slack.env;
|
||||
settings = {
|
||||
homeserver = {
|
||||
server_name = "sealight.xyz";
|
||||
url = "https://chat.sealight.xyz";
|
||||
};
|
||||
db = {
|
||||
engine = "postgres";
|
||||
connectionString = "postgres://slackbridge_user:somethingverysecret@localhost/slack_bridge?sslmode=require";
|
||||
};
|
||||
matrix_admin_room = "!ikEWOHCcmoZtVzSmPF:sealight.xyz";
|
||||
username_prefix = "slack_";
|
||||
rtm = {
|
||||
enable = true;
|
||||
logging = "silent";
|
||||
};
|
||||
slack_hook_port = 9899;
|
||||
enable_metrics = true;
|
||||
puppeting = {
|
||||
enabled = true;
|
||||
onboard_users = true;
|
||||
};
|
||||
oauth2 = {
|
||||
client_id = "2832868673.1609454840563";
|
||||
client_secret = "079a7ca42b192e66a9ff32740a69cb9d";
|
||||
redirect_prefix = "https://sealight.xyz/slackbridge/";
|
||||
};
|
||||
#team_sync = {
|
||||
# T02QGRJKT = {
|
||||
# users = {
|
||||
# enabled = false;
|
||||
# };
|
||||
# channels = {
|
||||
# enabled = true;
|
||||
# alias_prefix = "qf_";
|
||||
# };
|
||||
# };
|
||||
#};
|
||||
};
|
||||
};
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
## postgresql user and db name remains in the
|
||||
## service.matrix-synapse.database_args setting which
|
||||
## by default is matrix-synapse
|
||||
initialScript = pkgs.writeText "synapse-init.sql" ''
|
||||
CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD "Da0?H*9i{x?,]|'kq@iBwlIzu";
|
||||
CREATE DATABASE "matrix-synapse" WITH OWNER "matrix-synapse"
|
||||
TEMPLATE template0
|
||||
LC_COLLATE = "C"
|
||||
LC_CTYPE = "C";
|
||||
'';
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [
|
||||
22 # SSH
|
||||
8448 # Matrix federation
|
||||
8008
|
||||
80
|
||||
443
|
||||
9899 # Matrix <-> Slack Bridge Puppeting
|
||||
];
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
element-web = super.element-web.override {
|
||||
conf = {
|
||||
default_server_config = {
|
||||
"m.homeserver" = {
|
||||
"base_url" = "https://chat.sealight.xyz";
|
||||
"server_name" = "sealight.xyz";
|
||||
};
|
||||
"m.identity_server" = {
|
||||
"base_url" = "https://vector.im";
|
||||
};
|
||||
};
|
||||
|
||||
## jitsi will be setup later,
|
||||
## but we need to add to Riot configuration
|
||||
#jitsi.preferredDomain = "jitsi.dangerousdemos.net";
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
|
||||
"sealight.xyz" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
root = "/var/www/sealight.xyz";
|
||||
};
|
||||
locations."/_matrix" = {
|
||||
proxyPass = "http://localhost:8448";
|
||||
};
|
||||
locations."/slackbridge" = {
|
||||
proxyPass = "http://localhost:9899";
|
||||
};
|
||||
};
|
||||
## virtual host for Synapse
|
||||
"chat.sealight.xyz" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
#useACMEHost = "sealight.xyz";
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:8448";
|
||||
};
|
||||
};
|
||||
|
||||
## virtual host for Riot/Web
|
||||
"element.sealight.xyz" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
#useACMEHost = "sealight.xyz";
|
||||
|
||||
## root points to the riot-web package content, also configured via Nix
|
||||
locations."/" = {
|
||||
root = pkgs.element-web;
|
||||
};
|
||||
};
|
||||
};
|
||||
## other nginx specific best practices
|
||||
recommendedGzipSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedTlsSettings = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ matrix-appservice-slack ];
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.mautrix-whatsapp;
|
||||
|
||||
configFile = pkgs.runCommand "mautrix-whatsapp" {
|
||||
buildInputs = [ pkgs.mautrix-whatsapp pkgs.remarshal ];
|
||||
preferLocalBuild = true;
|
||||
} ''
|
||||
mkdir -p $out
|
||||
${pkgs.remarshal}/bin/json2yaml -i ${pkgs.writeText "config.json" (builtins.toJSON cfg.configOptions)} \
|
||||
-o $out/config.yaml
|
||||
|
||||
${pkgs.mautrix-whatsapp}/bin/mautrix-whatsapp -c $out/config.yaml -g -r $out/registration.yaml
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
options.services.mautrix-whatsapp = {
|
||||
enable = mkEnableOption "Mautrix-whatsapp, a puppeting bridge between Matrix and WhatsApp.";
|
||||
|
||||
configOptions = mkOption {
|
||||
type = types.attrs;
|
||||
description = ''
|
||||
This options will be transform in YAML configuration file for the bridge
|
||||
|
||||
Look <link xlink:href="https://github.com/tulir/mautrix-whatsapp/wiki/Bridge-setup">here</link> for documentation.
|
||||
'';
|
||||
example = {
|
||||
configOptions = {
|
||||
homeserver = {
|
||||
address = https://matrix.org;
|
||||
domain = "matrix.org";
|
||||
};
|
||||
appservice = {
|
||||
address = http://localhost:8080;
|
||||
hostname = "0.0.0.0";
|
||||
port = 8080;
|
||||
database = {
|
||||
type = "sqlite3";
|
||||
uri = "/var/lib/mautrix-whatsapp/mautrix-whatsapp.db";
|
||||
};
|
||||
state_store_path = "/var/lib/mautrix-whatsapp/mx-state.json";
|
||||
id = "whatsapp";
|
||||
bot = {
|
||||
username = "whatsappbot";
|
||||
displayname = "WhatsApp bridge bot";
|
||||
avatar = "mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr";
|
||||
};
|
||||
as_token = "";
|
||||
hs_token = "";
|
||||
};
|
||||
bridge = {
|
||||
username_template = "whatsapp_{{.}}";
|
||||
displayname_template = "{{if .Notify}}{{.Notify}}{{else}}{{.Jid}}{{end}} (WA)";
|
||||
command_prefix = "!wa";
|
||||
permissions = {
|
||||
"@example:matrix.org" = 100;
|
||||
};
|
||||
};
|
||||
logging = {
|
||||
directory = "/var/lib/mautrix-whatsapp/logs";
|
||||
file_name_format = "{{.Date}}-{{.Index}}.log";
|
||||
file_date_format = "\"2006-01-02\"";
|
||||
file_mode = 384;
|
||||
timestamp_format = "Jan _2, 2006 15:04:05";
|
||||
print_level = "debug";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.mautrix-whatsapp = {
|
||||
description = "Mautrix-WhatsApp Service - A WhatsApp bridge for Matrix";
|
||||
after = [ "network.target" "matrix-synapse.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
StateDirectory = "mautrix-whatsapp";
|
||||
LoggingDir = "mautrix-whatsapp";
|
||||
ExecStart = ''
|
||||
${pkgs.mautrix-whatsapp}/bin/mautrix-whatsapp -c "${configFile}/config.yaml"
|
||||
'';
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
||||
#services.matrix-synapse.app_service_config_files = [ "${configFile}/registration.yaml" ];
|
||||
|
||||
};
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
phppoolName = "shaarli";
|
||||
dataDir = "/var/lib/shaarli";
|
||||
vhost = "192.168.1.6:1233";
|
||||
|
||||
shaarli = pkgs.callPackage ./pkg-shaarli.nix {
|
||||
inherit dataDir;
|
||||
};
|
||||
in
|
||||
{
|
||||
services.nginx.virtualHosts."${vhost}" = {
|
||||
forceSSL = false;
|
||||
enableACME = false;
|
||||
root = "${shaarli}";
|
||||
listen = [ { addr = "192.168.1.6"; port = 1233; } ];
|
||||
# extraConfig = ''
|
||||
# index index.php;
|
||||
# '';
|
||||
locations."/" = {
|
||||
index = "index.php";
|
||||
extraConfig = ''
|
||||
try_files $uri $uri/ index.php;
|
||||
'';
|
||||
};
|
||||
locations."~ (index)\.php$" = {
|
||||
extraConfig = ''
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
if (!-f $document_root$fastcgi_script_name) {
|
||||
return 404;
|
||||
}
|
||||
|
||||
include ${pkgs.nginx}/conf/fastcgi.conf;
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools."${phppoolName}".socket};
|
||||
fastcgi_index index.php;
|
||||
'';
|
||||
};
|
||||
locations."~ \.php$" = {
|
||||
extraConfig = ''
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
};
|
||||
services.phpfpm.pools."${phppoolName}" = {
|
||||
user = "nginx";
|
||||
group = "nginx";
|
||||
settings = {
|
||||
"listen.owner" = "nginx";
|
||||
"listen.group" = "nginx";
|
||||
"user" = "nginx";
|
||||
"pm" = "dynamic";
|
||||
"pm.max_children" = "75";
|
||||
"pm.min_spare_servers" = "5";
|
||||
"pm.max_spare_servers" = "20";
|
||||
"pm.max_requests" = "10";
|
||||
"catch_workers_output" = "1";
|
||||
};
|
||||
};
|
||||
users.extraUsers.shaarli = { group = "shaarli"; };
|
||||
users.extraGroups.shaarli = { };
|
||||
systemd.services.shaarli-install = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = ''
|
||||
if [ ! -d "${dataDir}" ]; then
|
||||
mkdir -p ${dataDir}/{cache,data,pagecache,tmp}
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/cache/
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/data/
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/pagecache/
|
||||
cp -R ${shaarli}/data.orig/.htaccess ${dataDir}/tmp/
|
||||
fi
|
||||
chown -Rc nginx:nginx ${dataDir}
|
||||
find ${dataDir} -type d ! -perm 0700 -exec chmod 0700 {} \; -exec chmod g-s {} \;
|
||||
find ${dataDir} -type f ! -perm 0600 -exec chmod 0600 {} \;
|
||||
'';
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 1233 ];
|
||||
}
|
|
@ -1,263 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.wallabag;
|
||||
|
||||
poolName = "wallabag";
|
||||
|
||||
phpfpmSocketName = "/var/run/phpfpm/${poolName}.sock";
|
||||
|
||||
configFile = pkgs.writeTextFile {
|
||||
name = "wallabag-config";
|
||||
text = cfg.conf;
|
||||
destination = "/config/parameters.yml";
|
||||
};
|
||||
|
||||
appDir = pkgs.buildEnv {
|
||||
name = "wallabag-app-dir";
|
||||
ignoreCollisions = true;
|
||||
checkCollisionContents = false;
|
||||
paths = [ configFile "${cfg.package}/app" ];
|
||||
};
|
||||
|
||||
in {
|
||||
options = {
|
||||
services.wallabag = {
|
||||
enable = mkEnableOption "wallabag";
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "nginx";
|
||||
description = ''
|
||||
User account under which both the update daemon and the web-application run.
|
||||
'';
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/www/wallabag";
|
||||
description = ''
|
||||
Data directory.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.wallabag;
|
||||
description = ''
|
||||
Wallabag package to use.
|
||||
'';
|
||||
};
|
||||
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Name of the nginx virtualhost to use and setup.
|
||||
'';
|
||||
};
|
||||
|
||||
poolConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = ''
|
||||
pm = dynamic
|
||||
pm.max_children = 75
|
||||
pm.start_servers = 1
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 20
|
||||
pm.max_requests = 500
|
||||
catch_workers_output = 1
|
||||
'';
|
||||
description = ''
|
||||
Options for wallabag's PHP pool. See the documentation on <literal>php-fpm.conf</literal> for details on configuration directives.
|
||||
'';
|
||||
};
|
||||
|
||||
conf = mkOption {
|
||||
type = types.str;
|
||||
default = ''
|
||||
parameters:
|
||||
database_driver: pdo_pgsql
|
||||
database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
|
||||
database_host: 127.0.0.1
|
||||
database_port: ~
|
||||
database_name: wallabag
|
||||
database_user: wallabag
|
||||
database_password: ~
|
||||
# For SQLite, database_path should be "%kernel.project_dir%/data/db/wallabag.sqlite"
|
||||
database_path: null
|
||||
database_table_prefix: wallabag_
|
||||
database_socket: null
|
||||
# with PostgreSQL and SQLite, you must set "utf8"
|
||||
database_charset: utf8
|
||||
|
||||
domain_name: http://192.168.1.6:8080
|
||||
|
||||
mailer_transport: smtp
|
||||
mailer_user: ~
|
||||
mailer_password: ~
|
||||
mailer_host: 127.0.0.1
|
||||
mailer_port: false
|
||||
mailer_encryption: ~
|
||||
mailer_auth_mode: ~
|
||||
locale: en
|
||||
# A secret key that's used to generate certain security-related tokens
|
||||
secret: sateofg893964crfSTNFG"*(&@$091
|
||||
twofactor_auth: true
|
||||
twofactor_sender: no-reply@wallabag.org
|
||||
fosuser_registration: true
|
||||
fosuser_confirmation: true
|
||||
fos_oauth_server_access_token_lifetime: 3600
|
||||
fos_oauth_server_refresh_token_lifetime: 1209600
|
||||
from_email: no-reply@wallabag.org
|
||||
rss_limit: 50
|
||||
rabbitmq_host: localhost
|
||||
rabbitmq_port: 5672
|
||||
rabbitmq_user: ~
|
||||
rabbitmq_password: ~
|
||||
rabbitmq_prefetch_count: 0
|
||||
redis_scheme: tcp
|
||||
redis_host: localhost
|
||||
redis_port: 6379
|
||||
redis_path: ~
|
||||
redis_password: ~
|
||||
sentry_dsn: ~
|
||||
'';
|
||||
description = ''
|
||||
Contents of the wallabag configuration file (parameters.yml)
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
services.phpfpm.pools."${poolName}" = {
|
||||
user = "${cfg.user}";
|
||||
group = "nginx";
|
||||
settings = {
|
||||
"listen" = "${phpfpmSocketName}";
|
||||
"listen.owner" = "nginx";
|
||||
"listen.group" = "nginx";
|
||||
"listen.mode" = "0600";
|
||||
"env[WALLABAG_DATA]" = "${cfg.dataDir}";
|
||||
"pm" = "dynamic";
|
||||
"pm.max_children" = "75";
|
||||
"pm.min_spare_servers" = "5";
|
||||
"pm.max_spare_servers" = "20";
|
||||
"pm.max_requests" = "10";
|
||||
"catch_workers_output" = "1";
|
||||
};
|
||||
};
|
||||
services.phpfpm.phpOptions = ''
|
||||
max_execution_time = 120
|
||||
'';
|
||||
|
||||
services.nginx.enable = mkDefault true;
|
||||
|
||||
services.nginx.virtualHosts."${cfg.hostName}" = {
|
||||
root = "${cfg.package}/web";
|
||||
listen = [ { addr = "192.168.1.6"; port = 8080; } ];
|
||||
|
||||
extraConfig = ''
|
||||
add_header X-Frame-Options SAMEORIGIN;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
'';
|
||||
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
try_files $uri /app.php$is_args$args;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."/assets".root = "${cfg.dataDir}/web";
|
||||
|
||||
locations."~ ^/app\\.php(/|$)" = {
|
||||
extraConfig = ''
|
||||
fastcgi_pass unix:${phpfpmSocketName};
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
include ${pkgs.nginx}/conf/fastcgi_params;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME ${cfg.package}/web/$fastcgi_script_name;
|
||||
fastcgi_param DOCUMENT_ROOT ${cfg.package}/web;
|
||||
fastcgi_read_timeout 120;
|
||||
|
||||
internal;
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ /(?!app)\\.php$" = {
|
||||
extraConfig = ''
|
||||
return 404;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
|
||||
# Ensure the database, user, and permissions always exist
|
||||
ensureDatabases = [ "wallabag" "wallabag_user" ];
|
||||
authentication = lib.mkForce ''
|
||||
# Generated file; do not edit!
|
||||
# TYPE DATABASE USER ADDRESS METHOD
|
||||
local all all trust
|
||||
host all wallabag 127.0.0.1/32 trust
|
||||
'';
|
||||
ensureUsers = [
|
||||
{ name = "wallabag";
|
||||
ensurePermissions."DATABASE wallabag" = "ALL PRIVILEGES";
|
||||
ensurePermissions."DATABASE wallabag_user" = "ALL PRIVILEGES";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services.wallabag-install = {
|
||||
description = "Wallabag install service";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "phpfpm-wallabag.service" ];
|
||||
after = [ "mysql.service" "postgresql.service" ];
|
||||
path = with pkgs; [ coreutils php72 php72Packages.composer ];
|
||||
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = "yes";
|
||||
PermissionsStartOnly = true;
|
||||
};
|
||||
|
||||
preStart = ''
|
||||
mkdir -p "${cfg.dataDir}"
|
||||
chown ${cfg.user}:nginx "${cfg.dataDir}"
|
||||
'';
|
||||
|
||||
script = ''
|
||||
echo "Setting up wallabag files in ${cfg.dataDir} ..."
|
||||
cd "${cfg.dataDir}"
|
||||
|
||||
rm -rf var/cache/*
|
||||
rm -f app
|
||||
ln -sf ${appDir} app
|
||||
ln -sf ${cfg.package}/composer.{json,lock} .
|
||||
|
||||
export WALLABAG_DATA="${cfg.dataDir}"
|
||||
if [ ! -f installed ]; then
|
||||
php ${cfg.package}/bin/console --env=prod doctrine:database:create --if-not-exists --no-interaction
|
||||
#php ${cfg.package}/bin/console --env=prod doctrine:migrations:migrate --no-interaction
|
||||
# Until https://github.com/wallabag/wallabag/issues/3662 is fixed
|
||||
yes no | php ${cfg.package}/bin/console --env=prod wallabag:install
|
||||
touch installed
|
||||
else
|
||||
php ${cfg.package}/bin/console --env=prod doctrine:migrations:migrate --no-interaction
|
||||
fi
|
||||
php ${cfg.package}/bin/console --env=prod cache:clear
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
maintainers = with maintainers; [ chickensoupwithrice ];
|
||||
};
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
{ config, pkgs, ... }: {
|
||||
# grafana configuration
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
domain = "grafana.sealight.xyz";
|
||||
port = 2342;
|
||||
addr = "127.0.0.1";
|
||||
};
|
||||
|
||||
# nginx reverse proxy
|
||||
services.nginx.virtualHosts.${config.services.grafana.domain} = {
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
{ config, pkgs, ... }: {
|
||||
# grafana configuration
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
domain = "grafana.mossnet.lan";
|
||||
port = 2342;
|
||||
addr = "127.0.0.1";
|
||||
};
|
||||
|
||||
# nginx reverse proxy
|
||||
services.nginx.virtualHosts.${config.services.grafana.domain} = {
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
port = 9001;
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [ "systemd" ];
|
||||
port = 9002;
|
||||
};
|
||||
};
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "bowl";
|
||||
static_configs = [{
|
||||
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
services.loki = {
|
||||
enable = true;
|
||||
configFile = /var/loki-config.yaml;
|
||||
};
|
||||
|
||||
systemd.services.promtail = {
|
||||
description = "Promtail service for Loki";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.grafana-loki}/bin/promtail --config.file ${/var/promtail.yaml}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.navidrome;
|
||||
configFile = "/etc/navidrome/settings.json";
|
||||
dataFolder = "/var/lib/navidrome";
|
||||
in {
|
||||
options = {
|
||||
|
||||
services.navidrome = {
|
||||
enable = mkEnableOption "Navidrome music server and streamer";
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = with types; attrsOf (oneOf [ int str ]);
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
LogLevel = "INFO";
|
||||
BaseURL = "/music";
|
||||
ScanInterval = "10s";
|
||||
TranscodingCacheSize = "15MB";
|
||||
MusicFolder = "/data/music";
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Configuration for Navidrome, see <link xlink:href="https://www.navidrome.org/docs/usage/configuration-options/"/> for supported values.
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "navidrome";
|
||||
description = "User account under which Navidrome runs.";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "navidrome";
|
||||
description = "Group account under which Navidrome runs.";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
environment.etc."navidrome/settings.json".text = builtins.toJSON cfg.settings;
|
||||
|
||||
services.navidrome.settings = {
|
||||
DataFolder = dataFolder;
|
||||
ConfigFile = configFile;
|
||||
};
|
||||
|
||||
systemd.services.navidrome = {
|
||||
description = "Navidrome Music Server and Streamer compatible with Subsonic/Airsonic";
|
||||
after = [ "remote-fs.target" "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment = {
|
||||
ND_CONFIGFILE = configFile;
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.navidrome}/bin/navidrome";
|
||||
WorkingDirectory = dataFolder;
|
||||
TimeoutStopSec = "20";
|
||||
KillMode = "process";
|
||||
Restart = "on-failure";
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
DevicePolicy = "closed";
|
||||
NoNewPrivileges= " yes";
|
||||
PrivateTmp = "yes";
|
||||
PrivateUsers = "yes";
|
||||
ProtectControlGroups = "yes";
|
||||
ProtectKernelModules = "yes";
|
||||
ProtectKernelTunables = "yes";
|
||||
RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
|
||||
RestrictNamespaces = "yes";
|
||||
RestrictRealtime = "yes";
|
||||
SystemCallFilter = "~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap";
|
||||
ReadWritePaths = dataFolder;
|
||||
StateDirectory = baseNameOf dataFolder;
|
||||
};
|
||||
};
|
||||
|
||||
users.users = optionalAttrs (cfg.user == "navidrome") ({
|
||||
navidrome = {
|
||||
description = "Navidrome service user";
|
||||
name = cfg.user;
|
||||
group = cfg.group;
|
||||
isSystemUser = true;
|
||||
};
|
||||
});
|
||||
|
||||
users.groups = optionalAttrs (cfg.group == "navidrome") ({
|
||||
navidrome = {};
|
||||
});
|
||||
|
||||
};
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
{ pkgs, config, ... }:
|
||||
{
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
hostName = "mossnet.lan";
|
||||
#home = "/data/nextcloud";
|
||||
|
||||
# Use HTTPS for links
|
||||
https = false;
|
||||
|
||||
# Auto-update Nextcloud Apps
|
||||
autoUpdateApps.enable = true;
|
||||
# Set what time makes sense for you
|
||||
autoUpdateApps.startAt = "05:00:00";
|
||||
|
||||
config = {
|
||||
# Further forces Nextcloud to use HTTPS
|
||||
# overwriteProtocol = "https";
|
||||
|
||||
# Nextcloud PostegreSQL database configuration, recommended over using SQLite
|
||||
dbtype = "pgsql";
|
||||
dbuser = "nextcloud";
|
||||
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
|
||||
dbname = "nextcloud";
|
||||
dbpassFile = "/var/nextcloud-db-pass";
|
||||
|
||||
adminpassFile = "/var/nextcloud-admin-pass";
|
||||
adminuser = "admin";
|
||||
};
|
||||
};
|
||||
|
||||
# Enable PostgreSQL
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
|
||||
# Ensure the database, user, and permissions always exist
|
||||
ensureDatabases = [ "nextcloud" ];
|
||||
ensureUsers = [
|
||||
{ name = "nextcloud";
|
||||
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Ensure that postgres is running before running the setup
|
||||
systemd.services."nextcloud-setup" = {
|
||||
requires = ["postgresql.service"];
|
||||
after = ["postgresql.service"];
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
}
|
7
modules/nix-path.nix
Normal file
7
modules/nix-path.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ channel, inputs, ... }: {
|
||||
nix.nixPath = [
|
||||
"nixpkgs=${channel.input}"
|
||||
"nixos-config=${../lib/compat/nixos}"
|
||||
"home-manager=${inputs.home}"
|
||||
];
|
||||
}
|
261
modules/nvim.nix
261
modules/nvim.nix
|
@ -1,261 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
|
||||
#nvim
|
||||
{
|
||||
environment.variables.EDITOR = "nvim";
|
||||
environment.shellAliases = {
|
||||
k = "vim -c :VimwikiIndex";
|
||||
kz = "vim -c :VimwikiIndex -c :ZettelNew";
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
nodejs
|
||||
( neovim.override {
|
||||
vimAlias = true;
|
||||
configure = {
|
||||
packages.myPlugins = with pkgs.vimPlugins; {
|
||||
start = [
|
||||
vim-nix
|
||||
fzf-vim
|
||||
vim-elixir
|
||||
emmet-vim
|
||||
nerdtree
|
||||
goyo-vim
|
||||
vim-sneak
|
||||
lightline-vim
|
||||
csv-vim
|
||||
vimwiki
|
||||
coc-nvim
|
||||
coc-json
|
||||
coc-python
|
||||
coc-pairs
|
||||
coc-emmet
|
||||
emmet-vim
|
||||
LanguageClient-neovim
|
||||
ayu-vim
|
||||
rainbow_parentheses-vim
|
||||
vim-surround
|
||||
vim-fugitive
|
||||
#iron-nvim
|
||||
#nvim-colorizer
|
||||
vim-devicons
|
||||
# testing
|
||||
#vim-processing
|
||||
#vim-tidal
|
||||
taskwiki
|
||||
vim-zettel
|
||||
#vimwiki-sync
|
||||
];
|
||||
};
|
||||
customRC = ''
|
||||
set tabstop=2
|
||||
set showmatch
|
||||
set shiftwidth=2
|
||||
set noexpandtab
|
||||
set autoindent
|
||||
|
||||
set foldmethod=indent " fold based on indent
|
||||
set number
|
||||
set nocompatible
|
||||
set relativenumber
|
||||
set showtabline=2
|
||||
set autowriteall
|
||||
syntax on
|
||||
set list lcs=tab:\|\
|
||||
filetype plugin on
|
||||
|
||||
set termguicolors
|
||||
let ayucolor="dark"
|
||||
colorscheme ayu
|
||||
|
||||
" window
|
||||
nmap <leader>wh :topleft vnew<CR>
|
||||
nmap <leader>wl :botright vnew<CR>
|
||||
nmap <leader>wk :topleft new<CR>
|
||||
nmap <leader>wj :botright new<CR>
|
||||
|
||||
let mapleader = "\<Space>"
|
||||
|
||||
" lightline colorscheme
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'seoul256',
|
||||
\ }
|
||||
|
||||
" moving splits with vim movements.
|
||||
:tnoremap <A-h> <C-\><C-N><C-w>h
|
||||
:tnoremap <A-j> <C-\><C-N><C-w>j
|
||||
:tnoremap <A-k> <C-\><C-N><C-w>k
|
||||
:tnoremap <A-l> <C-\><C-N><C-w>l
|
||||
:inoremap <A-h> <C-\><C-N><C-w>h
|
||||
:inoremap <A-j> <C-\><C-N><C-w>j
|
||||
:inoremap <A-k> <C-\><C-N><C-w>k
|
||||
:inoremap <A-l> <C-\><C-N><C-w>l
|
||||
:nnoremap <A-h> <leader>h
|
||||
:nnoremap <A-j> <leader>j
|
||||
:nnoremap <A-k> <leader>k
|
||||
:nnoremap <A-l> <leader>l
|
||||
:nnoremap <F5> "=strftime("%Y-%m-%d %H:%M:")
|
||||
:inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M:")
|
||||
|
||||
" exit normal mode in terminal
|
||||
:tnoremap <C-n> <C-\><C-n>
|
||||
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
let g:syntastic_auto_loc_list = 1
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
|
||||
let g:rainbow_active = 0
|
||||
autocmd BufReadPost,BufNewFile c,py,nix RainbowParenthesesToggleAll
|
||||
|
||||
" keyboard commands
|
||||
map <leader>t :NERDTreeToggle<CR>
|
||||
map <leader>s :w<CR>
|
||||
map <leader>q :wq<CR>
|
||||
map <leader>r :RainbowParenthesesToggleAll<CR>
|
||||
map <leader>zs :ZettelSearch<CR>
|
||||
map <leader>zo :ZettelOpen<CR>
|
||||
map <leader>zn :ZettelNew<CR>
|
||||
|
||||
|
||||
" NERDTree
|
||||
" open on directory
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
|
||||
" coc
|
||||
"
|
||||
" if hidden is not set, TextEdit might fail.
|
||||
set hidden
|
||||
|
||||
" Some servers have issues with backup files, see #649
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
|
||||
" Better display for messages
|
||||
set cmdheight=2
|
||||
|
||||
" You will have bad experience for diagnostic messages when it's default 4000.
|
||||
set updatetime=300
|
||||
|
||||
" don't give |ins-completion-menu| messages.
|
||||
set shortmess+=c
|
||||
|
||||
" always show signcolumns
|
||||
set signcolumn=yes
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
|
||||
" Coc only does snippet and additional edit on confirm.
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
" Or use `complete_info` if your vim support it, like:
|
||||
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" Remap keys for gotos
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Use K to show documentation in preview window
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight symbol under cursor on CursorHold
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Remap for rename current word
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Remap for format selected region
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
|
||||
augroup mygroup
|
||||
autocmd!
|
||||
" Setup formatexpr specified filetype(s).
|
||||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||
" Update signature help on jump placeholder
|
||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||
augroup end
|
||||
|
||||
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
|
||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap for do codeAction of current line
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Fix autofix problem of current line
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
" Create mappings for function text object, requires document symbols feature of languageserver.
|
||||
xmap if <Plug>(coc-funcobj-i)
|
||||
xmap af <Plug>(coc-funcobj-a)
|
||||
omap if <Plug>(coc-funcobj-i)
|
||||
omap af <Plug>(coc-funcobj-a)
|
||||
|
||||
" Use <C-d> for select selections ranges, needs server support, like: coc-tsserver, coc-python
|
||||
nmap <silent> <C-d> <Plug>(coc-range-select)
|
||||
xmap <silent> <C-d> <Plug>(coc-range-select)
|
||||
|
||||
" Use `:Format` to format current buffer
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
|
||||
" Use `:Fold` to fold current buffer
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" use `:OR` for organize import of current buffer
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Add status line support, for integration with other plugin, checkout `:h coc-status`
|
||||
" set statusline^=%{coc#status()}%{get(b:,'coc_current_function',"")}
|
||||
|
||||
" Using CocList
|
||||
" Show all diagnostics
|
||||
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions
|
||||
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands
|
||||
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document
|
||||
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols
|
||||
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item.
|
||||
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item.
|
||||
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list
|
||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||
|
||||
au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl
|
||||
'';
|
||||
};
|
||||
}
|
||||
)];
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
vhost = {
|
||||
"sealight.xyz" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
root = "/var/www/sealight.xyz"
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
{ pkgs, config, ... }:
|
||||
let
|
||||
dataDir = "/var/www/shaarli-config";
|
||||
name = "shaarli";
|
||||
in
|
||||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
"links.mossnet.lan" = {
|
||||
forceSSL = false;
|
||||
enableACME = false;
|
||||
root = "${dataDir}";
|
||||
#listen = [ { addr = "192.168.1.6"; port = 1234; } ];
|
||||
extraConfig = ''
|
||||
index index.php;
|
||||
'';
|
||||
locations = {
|
||||
"/".extraConfig = ''
|
||||
try_files $uri $uri/ index.php;
|
||||
'';
|
||||
|
||||
"~ (index)\.php$".extraConfig = ''
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
if (!-f $document_root$fastcgi_script_name) {
|
||||
return 404;
|
||||
}
|
||||
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools."${name}".socket};
|
||||
fastcgi_index index.php;
|
||||
|
||||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_param REQUEST_METHOD $request_method;
|
||||
fastcgi_param CONTENT_TYPE $content_type;
|
||||
fastcgi_param CONTENT_LENGTH $content_length;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param DOCUMENT_URI $document_uri;
|
||||
fastcgi_param DOCUMENT_ROOT $document_root;
|
||||
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
||||
|
||||
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
||||
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
||||
|
||||
fastcgi_param REMOTE_ADDR $remote_addr;
|
||||
fastcgi_param REMOTE_PORT $remote_port;
|
||||
fastcgi_param SERVER_ADDR $server_addr;
|
||||
fastcgi_param SERVER_PORT $server_port;
|
||||
fastcgi_param SERVER_NAME $server_name;
|
||||
'';
|
||||
|
||||
"~ \.php$".extraConfig = ''
|
||||
deny all;
|
||||
'';
|
||||
|
||||
"^~ /tpl/".extraConfig = "alias ${pkgs.shaarli}/tpl/;";
|
||||
|
||||
"^~ /plugins/".extraConfig = "alias ${pkgs.shaarli}/plugins/;";
|
||||
|
||||
"~* \\.(?:ico|css|js|gif|jpe?g|png)$".extraConfig = ''
|
||||
expires max;
|
||||
add_header Pragma public;
|
||||
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.phpfpm = {
|
||||
pools = {
|
||||
"${name}" = {
|
||||
user = "nginx";
|
||||
group = "nginx";
|
||||
#listen = "/run/phpfpm/php.sock";
|
||||
settings = {
|
||||
"listen.owner" = "nginx";
|
||||
"listen.group" = "nginx";
|
||||
"user" = "nginx";
|
||||
"pm" = "dynamic";
|
||||
"pm.max_children" = "4";
|
||||
"pm.min_spare_servers" = "1";
|
||||
"pm.max_spare_servers" = "4";
|
||||
"pm.max_requests" = "32";
|
||||
"catch_workers_output" = "1";
|
||||
"php_admin_value[error_log]" = "/var/log/nginx/${name}-phpfpm-error.log";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
users.extraUsers."${name}" = { group = "${name}"; };
|
||||
users.extraGroups."${name}" = { };
|
||||
systemd.services.shaarli-install = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = ''
|
||||
if [ ! -d "${dataDir}" ]; then
|
||||
mkdir -p ${dataDir}/{cache,data,pagecache,tmp}
|
||||
cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/cache/
|
||||
cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/data/
|
||||
cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/pagecache/
|
||||
cp -R ${pkgs.shaarli}/data.orig/.htaccess ${dataDir}/tmp/
|
||||
ln -S ${pkgs.shaarli}/* ${dataDir}
|
||||
fi
|
||||
chown -Rc nginx:nginx ${dataDir}
|
||||
find ${dataDir} -type d ! -perm 0700 -exec chmod 0700 {} \; -exec chmod g-s {} \;
|
||||
find ${dataDir} -type f ! -perm 0600 -exec chmod 0600 {} \;
|
||||
'';
|
||||
};
|
||||
# TODO: Write the configuration file here?
|
||||
networking.firewall.allowedTCPPorts = [ 1234 ];
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.taskserver.enable = true;
|
||||
services.taskserver.fqdn = "192.168.1.6";
|
||||
services.taskserver.listenHost = "192.168.1.6";
|
||||
services.taskserver.listenPort = 53589;
|
||||
services.taskserver.organisations.mossnet.users = [ "anish" ];
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.wireguard pkgs.mosh ];
|
||||
networking.nat = {
|
||||
enable = true;
|
||||
externalInterface = "ens3";
|
||||
internalInterfaces = [ "wg0" ];
|
||||
};
|
||||
networking.firewall = {
|
||||
allowedUDPPorts = [ 60990 ];
|
||||
};
|
||||
|
||||
networking.wireguard.interfaces.wg0 = {
|
||||
ips = [ "10.0.69.1/24" ];
|
||||
listenPort = 60990;
|
||||
privateKeyFile = "/var/lib/wireguard/priv";
|
||||
peers = [{ # bowl
|
||||
publicKey = "EzvDUmHXo95S2jKRv/LkH5ItUNOBgM7aQQsaq1WfCRw=";
|
||||
allowedIPs = [ "10.0.69.2/32" ];
|
||||
}
|
||||
{ # line
|
||||
publicKey = "ViRabGV2Mv0SZUVWnoAUhIzaHEvqRXAZJLq3Bp1oN1k=";
|
||||
allowedIPs = [ "10.0.69.3/32" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
boot.extraModulePackages = with config.boot.kernelPackages; [ wireguard ];
|
||||
environment.systemPackages = [ pkgs.wireguard ];
|
||||
networking.wireguard.enable = true;
|
||||
networking.wireguard.interfaces = {
|
||||
wg0 = {
|
||||
ips = [ "10.0.69.2/32" ];
|
||||
privateKeyFile = "/var/lib/wireguard/priv";
|
||||
|
||||
peers = [
|
||||
{ # helix - server
|
||||
publicKey = "{c1J4p63rD3IlszugMZiki7UBV3YmDdqa3DU4UejXzAI=}";
|
||||
allowedIPs = [ "10.0.69.1/24" ];
|
||||
endpoint = "sealight.xyz:60990";
|
||||
persistentKeepalive = 25;
|
||||
} ];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eux
|
||||
|
||||
hostname="bowl"
|
||||
password="xxx"
|
||||
|
||||
diskdev=/dev/sda
|
||||
rootpart=/dev/sda2
|
||||
|
||||
# -o clear
|
||||
# -g convert to gpt disk
|
||||
# -n new partition num:start:end +size
|
||||
# ef00 EFI / 8300 linux fs
|
||||
sgdisk -o -g -n 1::+5M -t 1:ef02 -n 2:: -t 2:8300 $diskdev
|
||||
|
||||
# LVM part
|
||||
echo "$password" | cryptsetup luksFormat --type luks1 -h sha512 $rootpart
|
||||
echo "$password" | cryptsetup luksOpen $rootpart enc-pv
|
||||
|
||||
pvcreate /dev/mapper/enc-pv
|
||||
vgcreate vg0 /dev/mapper/enc-pv
|
||||
lvcreate -L 8G -n swap vg0
|
||||
lvcreate -L 40G -n nixos vg0
|
||||
lvcreate -l '100%FREE' -n home vg0
|
||||
|
||||
# format disk
|
||||
mkfs.ext4 -L root /dev/vg0/nixos
|
||||
mkfs.ext4 -L home /dev/vg0/home
|
||||
mkswap -L swap /dev/vg0/swap
|
||||
|
||||
swapon /dev/vg0/swap
|
||||
mount /dev/vg0/nixos /mnt
|
||||
|
||||
nix-channel --add https://nixos.org/channels/nixos-unstable nixos
|
||||
nix-channel --update
|
||||
|
||||
nixos-generate-config --root /mnt
|
||||
|
||||
for uuid in /dev/disk/by-uuid/*
|
||||
do
|
||||
if test $(readlink -f $uuid) = $rootpart
|
||||
then
|
||||
luksuuid=$uuid
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
cat << EOF > /mnt/etc/nixos/configuration.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
boot.loader.grub.devices = [ "/dev/sda" ];
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.version = 2;
|
||||
boot.loader.grub.enableCryptodisk = true;
|
||||
boot.loader.supportsInitrdSecrets = true;
|
||||
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||
boot.initrd.availableKernelModules = ["virtio-pci"];
|
||||
boot.initrd.network = {
|
||||
enable = true;
|
||||
ssh = {
|
||||
enable = true;
|
||||
port = 2222;
|
||||
authorizedKeys = ["ssh-rsa xxx"];
|
||||
hostKeys = [ "/host_ecdsa_key" ];
|
||||
};
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices = [
|
||||
{
|
||||
name = "enc-pv";
|
||||
preLVM = true;
|
||||
device = "$luksuuid";
|
||||
allowDiscards = true;
|
||||
}
|
||||
];
|
||||
|
||||
boot.initrd.secrets = {
|
||||
"/host_ecdsa_key" = "/host_ecdsa_key";
|
||||
};
|
||||
|
||||
boot.cleanTmpDir = true;
|
||||
boot.kernelModules = [ "dm-snapshot" ];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
users.users.root.initialHashedPassword = "";
|
||||
services.openssh.permitRootLogin = "prohibit-password";
|
||||
networking.hostName = "$hostname";
|
||||
time.timeZone = "Europe/Paris";
|
||||
services.openssh.enable = true;
|
||||
users.users.root.openssh.authorizedKeys.keys = ["ssh-rsa xxx"];
|
||||
system.stateVersion = "20.03";
|
||||
}
|
||||
EOF
|
||||
|
||||
ssh-keygen -t ecdsa -N "" -f host_ecdsa_key
|
||||
|
||||
cp host_ecdsa_key /mnt/
|
||||
|
||||
nixos-install --no-root-passwd
|
||||
|
5
overlays/manix.nix
Normal file
5
overlays/manix.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
final: prev: {
|
||||
manix = prev.manix.overrideAttrs (o: rec{
|
||||
inherit (prev.sources.manix) pname version src;
|
||||
});
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue