Initial commit with half arsed flake
This commit is contained in:
commit
32be7882be
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Eggtils
|
||||
|
||||
A collection of random scripts that I wanted to put into a package ofr clarity's
|
||||
sake.
|
26
flake.lock
Normal file
26
flake.lock
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1627805549,
|
||||
"narHash": "sha256-+LHhcpzw6vAxF6q0VSLkZSEGpDC02JN21KM8eUWz+is=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "16bf3980bfa0d8929639be93fa8491ebad9d61ec",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-21.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
118
flake.nix
Normal file
118
flake.nix
Normal file
|
@ -0,0 +1,118 @@
|
|||
{
|
||||
description = "An over-engineered Hello World in bash";
|
||||
|
||||
# Nixpkgs / NixOS version to use.
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-21.05";
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
|
||||
# to work with older version of flakes
|
||||
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";
|
||||
|
||||
# Generate a user-friendly version number.
|
||||
version = builtins.substring 0 8 lastModifiedDate;
|
||||
|
||||
# System types to support.
|
||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||
|
||||
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
|
||||
# Nixpkgs instantiated for supported system types.
|
||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
# A Nixpkgs overlay.
|
||||
overlay = final: prev: {
|
||||
|
||||
hello = with final; stdenv.mkDerivation rec {
|
||||
name = "hello-${version}";
|
||||
|
||||
unpackPhase = ":";
|
||||
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
cp hello $out/bin/
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
# Provide some binary packages for selected system types.
|
||||
packages = forAllSystems (system:
|
||||
{
|
||||
inherit (nixpkgsFor.${system}) hello;
|
||||
});
|
||||
|
||||
# The default package for 'nix build'. This makes sense if the
|
||||
# flake provides only one package or there is a clear "main"
|
||||
# package.
|
||||
defaultPackage = forAllSystems (system: self.packages.${system}.hello);
|
||||
|
||||
# A NixOS module, if applicable (e.g. if the package provides a system service).
|
||||
nixosModules.hello =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
nixpkgs.overlays = [ self.overlay ];
|
||||
|
||||
environment.systemPackages = [ pkgs.hello ];
|
||||
|
||||
#systemd.services = { ... };
|
||||
};
|
||||
|
||||
# Tests run by 'nix flake check' and by Hydra.
|
||||
checks = forAllSystems
|
||||
(system:
|
||||
with nixpkgsFor.${system};
|
||||
|
||||
{
|
||||
inherit (self.packages.${system}) hello;
|
||||
|
||||
# Additional tests, if applicable.
|
||||
test = stdenv.mkDerivation {
|
||||
name = "hello-test-${version}";
|
||||
|
||||
buildInputs = [ hello ];
|
||||
|
||||
unpackPhase = "true";
|
||||
|
||||
buildPhase = ''
|
||||
echo 'running some integration tests'
|
||||
[[ $(hello) = 'Hello Nixers!' ]]
|
||||
'';
|
||||
|
||||
installPhase = "mkdir -p $out";
|
||||
};
|
||||
}
|
||||
|
||||
// lib.optionalAttrs stdenv.isLinux {
|
||||
# A VM test of the NixOS module.
|
||||
vmTest =
|
||||
with import (nixpkgs + "/nixos/lib/testing-python.nix") {
|
||||
inherit system;
|
||||
};
|
||||
|
||||
makeTest {
|
||||
nodes = {
|
||||
client = { ... }: {
|
||||
imports = [ self.nixosModules.hello ];
|
||||
};
|
||||
};
|
||||
|
||||
testScript =
|
||||
''
|
||||
start_all()
|
||||
client.wait_for_unit("multi-user.target")
|
||||
client.succeed("hello")
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
}
|
6
open-bookmark
Executable file
6
open-bookmark
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
bookmarks="${BOOKMARKS:-"$HOME/.config/qutebrowser/bookmarks/urls"}"
|
||||
menu="${MENU:-"rofi -dmenu"}"
|
||||
|
||||
choice="$(sort $bookmarks | $menu -i -p "Bookmarks")"
|
||||
xdg-open "$(echo "$choice" | awk '{print$1}')"
|
Loading…
Reference in a new issue