2022-05-21 00:07:49 +00:00
# docs:
# https://nixos.wiki/wiki/Flakes
# https://serokell.io/blog/practical-nix-flakes
{
inputs = {
nixpkgs . url = " n i x p k g s / n i x o s - 2 1 . 1 1 " ;
2022-05-21 04:14:19 +00:00
pkgs-gitea . url = " n i x p k g s / c 7 7 7 c d f 5 c 5 6 4 0 1 5 d 5 f 6 3 b 0 9 c c 9 3 b e f 4 1 7 8 b 1 9 b 0 1 " ;
2022-05-21 07:15:33 +00:00
pkgs-mobile . url = " n i x p k g s / 6 d a a 4 a 5 c 0 4 5 d 4 0 e 6 e a e 6 0 a 3 b 6 e 4 2 7 e 8 7 0 0 f 1 c 0 7 f " ; # currently pinned to mobile-nixos tip
# pkgs-mobile.url = "nixpkgs/7e567a3d092b7de69cdf5deaeb8d9526de230916"; # 2021/06/21, coordinated with mobile-nixos 85557dca93ae574eaa7dc7b1877edf681a280d35 ; builds linux, but no errors after running for 4 hours
2022-05-21 06:53:44 +00:00
# pkgs-mobile.url = "nixpkgs/cbe587c735b734405f56803e267820ee1559e6c1"; # successful mobile-nixos build https://hydra.nixos.org/eval/1759474#tabs-inputs
# pkgs-mobile.url = "nixpkgs/48037fd90426e44e4bf03e6479e88a11453b9b66"; # successful mobile-nixos build 2022/05/19 https://hydra.nixos.org/eval/1762659#tabs-inputs
# pkgs-mobile.url = "nixpkgs/1d7db1b9e4cf1ee075a9f52e5c36f7b9f4207502";
# pkgs-mobile.url = "nixpkgs/43ff6cb1c027d13dc938b88eb099462210fea52f";
# pkgs-mobile.url = "nixpkgs/98bb5b77c8c6666824a4c13d23befa1e07210ef1"; # mobile-nixos build 2022/02/10 https://hydra.nixos.org/eval/1743260#tabs-inputs fails building lvgui
# pkgs-mobile.url = "nixpkgs/nixos-21.11"; # linux fails at config time
# pkgs-mobile.url = "nixpkgs/5aaed40d22f0d9376330b6fa413223435ad6fee5"; # (untested) associated with HN comment 2022/01/16 https://hydra.nixos.org/build/164693256#tabs-buildinputs -- still tries to compile linux from source
# pkgs-mobile.url = "nixpkgs/23d785aa6f853e6cf3430119811c334025bbef55"; # latest mobile-nixos:unstable:device.pine64-pinephone.aarch64-linux build 2022/02/20 https://hydra.nixos.org/build/167888996#tabs-buildinputs -- still tries to compile linux from source, fails building lvgui
2022-05-21 04:18:04 +00:00
# this includes a patch to enable flake support
mobile-nixos . url = " g i t h u b : n g i - n i x / m o b i l e - n i x o s / a f e 0 2 2 e 1 8 9 8 a a 0 5 3 8 1 0 7 7 a 8 9 c 3 6 8 1 7 8 4 e 6 0 7 4 4 5 8 " ;
2022-05-22 01:05:32 +00:00
home-manager = {
url = " g i t h u b : n i x - c o m m u n i t y / h o m e - m a n a g e r / r e l e a s e - 2 1 . 1 1 " ;
inputs . nixpkgs . follows = " n i x p k g s " ;
} ;
2022-05-21 00:07:49 +00:00
} ;
2022-05-21 07:30:29 +00:00
2022-05-22 05:00:38 +00:00
outputs = { self , nixpkgs , pkgs-gitea , pkgs-mobile , mobile-nixos , home-manager }: {
2022-05-21 07:40:56 +00:00
nixosConfigurations . uninsane = self . decl-machine {
2022-05-21 00:07:49 +00:00
system = " a a r c h 6 4 - l i n u x " ;
2022-05-22 08:29:56 +00:00
extraModules = [ ./machines/uninsane ] ;
2022-05-21 00:07:49 +00:00
} ;
2022-05-21 04:14:19 +00:00
2022-05-22 08:27:02 +00:00
nixosConfigurations . desko = self . decl-machine {
system = " x 8 6 _ 6 4 - l i n u x " ;
2022-05-22 08:29:56 +00:00
extraModules = [ ./machines/desko ] ;
2022-05-22 08:27:02 +00:00
} ;
2022-05-21 07:40:56 +00:00
nixosConfigurations . lappy = self . decl-machine {
2022-05-21 04:14:19 +00:00
system = " x 8 6 _ 6 4 - l i n u x " ;
2022-05-22 08:29:56 +00:00
extraModules = [ ./machines/lappy ] ;
2022-05-21 04:14:19 +00:00
} ;
2022-05-22 08:38:19 +00:00
packages . x86_64-linux . lappy-img = self . decl-img {
system = " x 8 6 _ 6 4 - l i n u x " ;
extraModules = [ ./machines/lappy ] ;
} ;
2022-05-22 01:05:32 +00:00
2022-05-21 04:18:04 +00:00
nixosConfigurations . pda = pkgs-mobile . lib . nixosSystem {
2022-05-22 01:05:32 +00:00
# inherit (self.genpkgs.aarch64-linux) pkgs;
2022-05-21 04:18:04 +00:00
system = " a a r c h 6 4 - l i n u x " ;
modules = [
# ({ pkgs, ... }: {
# nixpkgs.config.allowUnfree = true;
# })
# home-manager.nixosModules.home-manager {
# home-manager.useGlobalPkgs = true;
# home-manager.useUserPackages = true;
# home-manager.users.colin.imports = [ ./colin.nix ];
# }
# ./configuration.nix
# ./users.nix
mobile-nixos . nixosModules . pine64-pinephone ( {
users . users . root . password = " 1 4 7 1 4 7 " ;
} )
2022-05-21 06:53:44 +00:00
( { pkgs , . . . }: {
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘ s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system . stateVersion = " 2 1 . 1 1 " ; # Did you read the comment?
} )
2022-05-21 04:18:04 +00:00
# ({ pkgs, mobile-nixos, ... }: {
# imports = [
# (import "${mobile-nixos}/lib/configuration.nix" { device = "pine64-pinephone"; })
# ];
# })
# ({ pkgs, ... }: {
# imports = [
# <mobnixos>/devices/pine64-pinephone
# ];
# })
] ;
} ;
2022-05-21 07:30:29 +00:00
2022-05-21 07:40:56 +00:00
decl-machine = { system , extraModules }: ( nixpkgs . lib . nixosSystem {
2022-05-22 01:05:32 +00:00
pkgs = self . genpkgs . " ${ system } " . pkgs ;
2022-05-21 07:40:56 +00:00
system = " ${ system } " ;
specialArgs = { home-manager = home-manager ; } ;
modules = [
./configuration.nix
./modules
] ++ extraModules ;
} ) ;
2022-05-22 08:38:19 +00:00
# this produces a EFI-bootable .img file (GPT with / and /boot).
# after building this, steps are:
# run `btrfs-convert --uuid copy <device>`
# boot, checkout this flake into /etc/nixos AND UPDATE THE UUIDS IT REFERENCES.
# then `nixos-rebuild ...`
decl-img = { system , extraModules }: (
let
image = nixpkgs . lib . nixosSystem {
pkgs = self . genpkgs . " ${ system } " . pkgs ;
system = " ${ system } " ;
specialArgs = { home-manager = home-manager ; } ;
modules = [
./configuration.nix
./modules
./image.nix
] ++ extraModules ;
} ;
in image . config . system . build . raw
) ;
2022-05-22 01:05:32 +00:00
genpkgs = nixpkgs . lib . genAttrs nixpkgs . lib . platforms . all ( system :
2022-05-21 07:18:17 +00:00
{
2022-05-21 07:23:29 +00:00
pkgs = import nixpkgs {
inherit system ;
config . allowUnfree = true ;
overlays = [
( self : super : {
#### customized packages
# nixos-unstable pleroma is too far out-of-date for our db
pleroma = super . callPackage ./pkgs/pleroma { } ;
# jackett doesn't allow customization of the bind address: this will probably always be here.
jackett = self . callPackage ./pkgs/jackett { pkgs = super ; } ;
# fix abrupt HDD poweroffs as during reboot. patching systemd requires rebuilding nearly every package.
# systemd = import ./pkgs/systemd { pkgs = super; };
#### nixos-unstable packages
# gitea: 1.16.5 contains a fix which makes manual user approval *actually* work.
# https://github.com/go-gitea/gitea/pull/19119
# safe to remove after 1.16.5 (or 1.16.7 if we need db compat?)
gitea = pkgs-gitea . legacyPackages . " ${ system } " . gitea ;
# patch rpi uboot with something that fixes USB HDD boot
ubootRaspberryPi4_64bit = self . callPackage ./pkgs/ubootRaspberryPi4_64bit { pkgs = super ; } ;
} )
] ;
} ;
2022-05-21 07:18:17 +00:00
}
) ;
2022-05-21 00:07:49 +00:00
} ;
}