Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1787d4da99 |
5 changed files with 8 additions and 115 deletions
1
.envrc
1
.envrc
|
|
@ -1 +0,0 @@
|
||||||
use flake . --builders ""
|
|
||||||
27
flake.lock
generated
27
flake.lock
generated
|
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1741851582,
|
|
||||||
"narHash": "sha256-cPfs8qMccim2RBgtKGF+x9IBCduRvd/N5F4nYpU0TVE=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "6607cf789e541e7873d40d3a8f7815ea92204f32",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
||||||
34
flake.nix
34
flake.nix
|
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
|
||||||
|
|
||||||
outputs = {
|
|
||||||
self,
|
|
||||||
nixpkgs,
|
|
||||||
}: let
|
|
||||||
# Compose a flake for multiple systems directly. More systems, e.g. aarch64-darwin
|
|
||||||
# can be supported by adding them to the systems list.
|
|
||||||
systems = ["x86_64-linux" "aarch64-linux"];
|
|
||||||
forEachSystem = nixpkgs.lib.genAttrs systems;
|
|
||||||
pkgsForEach = nixpkgs.legacyPackages;
|
|
||||||
in {
|
|
||||||
packages = forEachSystem (system: {
|
|
||||||
# Add a discorss package, and alias default package to it.
|
|
||||||
# This will allow 'nix run .', which calls the default package.
|
|
||||||
default = self.packages.${system}.discorss;
|
|
||||||
discorss = pkgsForEach.${system}.callPackage ./nix/package.nix {};
|
|
||||||
});
|
|
||||||
|
|
||||||
devShells = forEachSystem (system: {
|
|
||||||
default = pkgsForEach.${system}.mkShellNoCC {
|
|
||||||
packages = [
|
|
||||||
# Add the Discorss package to the shell
|
|
||||||
self.packages.${system}.discorss
|
|
||||||
|
|
||||||
# Add the *dependencies* of the Discorss package to the shell
|
|
||||||
# so that it can be used to hack on the script itself.
|
|
||||||
self.packages.${system}.discorss.propagatedBuildInputs
|
|
||||||
];
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -13,6 +13,14 @@ printf "\e[1;34mDisco\e[1;38;5;208mRSS\e[0m Install Helper Script\n\n"
|
||||||
|
|
||||||
workingDir=$(pwd)
|
workingDir=$(pwd)
|
||||||
|
|
||||||
|
# bail if we're on a non-systemd system, suggest cron
|
||||||
|
if [[ -d /run/systemd/system ]]; then
|
||||||
|
printf "systemd detected..."
|
||||||
|
else
|
||||||
|
printf "This script and DiscoRSS in general are optimized for systemd! You can use cron as a substitute but I haven't written any documentation for it, so you're on your own for now!"
|
||||||
|
exit 127 # command not found exit code
|
||||||
|
fi
|
||||||
|
|
||||||
printf "Would you like the systemd service and timer files created for you? [y/n]: "
|
printf "Would you like the systemd service and timer files created for you? [y/n]: "
|
||||||
read answer
|
read answer
|
||||||
if [[ "$answer" =~ ^([yY])$ ]]; then
|
if [[ "$answer" =~ ^([yY])$ ]]; then
|
||||||
|
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
stdenvNoCC,
|
|
||||||
makeWrapper,
|
|
||||||
python312,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
||||||
pname = "discorss";
|
|
||||||
version = "0.0.1";
|
|
||||||
|
|
||||||
# Point to the repository root for the source. `builtins.path` is used to construct
|
|
||||||
# a pure and reproducible source path that doesn't change based on the name
|
|
||||||
# of the directory our source code lives in. Alternative to this is to just use it
|
|
||||||
# directly, as follows:
|
|
||||||
# `src = ../.;`
|
|
||||||
src = builtins.path {
|
|
||||||
path = ../.;
|
|
||||||
name = "discorss"; # the directory will always be named discorss in the eyes of Nix
|
|
||||||
filter = lib.cleanSourceFilter; # avoid copying junk files and vsc dirs to the store
|
|
||||||
};
|
|
||||||
|
|
||||||
# programs and libraries *used at build-time* that, if they are a compiler or similar tool, produce
|
|
||||||
# code to run at run-time. In other words, tools used to build the new derivation
|
|
||||||
# Alternative is buildInputs, which includes programs and libraries used by the new derivation at run-time
|
|
||||||
nativeBuildInputs = [makeWrapper];
|
|
||||||
|
|
||||||
# Normally propagatedBuildInputs get, well, propagated to the final build. This is not the
|
|
||||||
# case for s since we omit a handful of shell hooks that would handle it for us. We can
|
|
||||||
# still use propagatedBuildInputs to remain close to the standard, but we will have to
|
|
||||||
# pass it to the wrapper manually.
|
|
||||||
propagatedBuildInputs = [
|
|
||||||
# Create a python wrapper with the dependencies that we need.
|
|
||||||
# This will produce a /nix/store/some-hash-python/bin/python3 that has the modules
|
|
||||||
# our program needs.
|
|
||||||
(python312.withPackages (ps: with ps; [feedparser requests]))
|
|
||||||
];
|
|
||||||
|
|
||||||
dontUnpack = true; # source is not an archive
|
|
||||||
dontConfigure = true; # there is no configure script
|
|
||||||
dontPatch = true; # we are building from source, patches are redundant
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
|
|
||||||
# Create a wrapper for Discorss with the specific version of Python (with dependencies)
|
|
||||||
# added to its PATH.
|
|
||||||
makeWrapper $src/discorss.py $out/bin/discorss \
|
|
||||||
--prefix PATH : "${lib.makeBinPath finalAttrs.propagatedBuildInputs}"
|
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
|
||||||
})
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue