-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
332 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
flake-profile-1-link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/v3k7n7q44754h7cd8fvr3gyjq6dwmqk8-nix-shell-env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DATABASE_URL=sqlite://db.sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
use flake | ||
dotenv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
target | ||
db.sqlite |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "nixpkgs-update" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
diesel = { version = "2.1.0", features = ["sqlite"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# For documentation on how to configure this file, | ||
# see https://diesel.rs/guides/configuring-diesel-cli | ||
|
||
[print_schema] | ||
file = "src/schema.rs" | ||
custom_type_derives = ["diesel::query_builder::QueryId"] | ||
|
||
[migrations_directory] | ||
dir = "migrations" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
description = "update nixpkgs automatically"; | ||
|
||
outputs = { self, nixpkgs } @ args: let | ||
pkgs = nixpkgs.legacyPackages.x86_64-linux; | ||
in { | ||
devShells.x86_64-linux.default = pkgs.mkShell { | ||
packages = [ | ||
pkgs.cargo | ||
pkgs.clippy | ||
pkgs.sqlite | ||
pkgs.diesel-cli | ||
]; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP table packages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
CREATE TABLE packages ( | ||
id text PRIMARY KEY NOT NULL | ||
, attr_path text NOT NULL | ||
, version_nixpkgs_master text | ||
, version_nixpkgs_staging text | ||
, version_nixpkgs_staging_next text | ||
, version_repology text | ||
, version_github text | ||
, version_gitlab text | ||
, version_pypi text | ||
, project_repology text | ||
, nixpkgs_name_replogy text | ||
, owner_github text | ||
, repo_github text | ||
, owner_gitlab text | ||
, repo_gitlab text | ||
, last_checked_repology text | ||
, last_checked_github text | ||
, last_hecked_gitlab text | ||
, last_hecked_pypi text | ||
, last_checked_pending_pr text | ||
, last_update_attempt text | ||
, pending_pr integer | ||
, pending_pr_owner text | ||
, pending_pr_branch_name text | ||
, last_update_log text | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pub mod models; | ||
pub mod schema; | ||
|
||
use diesel::prelude::*; | ||
use std::env; | ||
|
||
pub fn establish_connection() -> SqliteConnection { | ||
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); | ||
SqliteConnection::establish(&database_url) | ||
.unwrap_or_else(|_| panic!("Error connecting to {}", database_url)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use nixpkgs_update::models::*; | ||
use nixpkgs_update::*; | ||
use diesel::prelude::*; | ||
|
||
fn main() { | ||
use nixpkgs_update::schema::packages::dsl::*; | ||
|
||
let connection = &mut establish_connection(); | ||
let results : Vec<Package> = | ||
packages. | ||
load(connection) | ||
.expect("Error loading packages"); | ||
|
||
println!("Displaying {} packages", results.len()); | ||
for package in results { | ||
println!("{} {}", package.id, package.attr_path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use diesel::prelude::*; | ||
|
||
#[derive(Queryable, Selectable)] | ||
#[diesel(table_name = crate::schema::packages)] | ||
#[diesel(check_for_backend(diesel::sqlite::Sqlite))] | ||
pub struct Package { | ||
pub id: String, | ||
pub attr_path: String, | ||
pub version_nixpkgs_master: Option<String>, | ||
pub version_nixpkgs_staging: Option<String>, | ||
pub version_nixpkgs_staging_next: Option<String>, | ||
pub version_repology: Option<String>, | ||
pub version_github: Option<String>, | ||
pub version_gitlab: Option<String>, | ||
pub version_pypi: Option<String>, | ||
pub project_repology: Option<String>, | ||
pub nixpkgs_name_replogy: Option<String>, | ||
pub owner_github: Option<String>, | ||
pub repo_github: Option<String>, | ||
pub owner_gitlab: Option<String>, | ||
pub repo_gitlab: Option<String>, | ||
pub last_checked_repology: Option<String>, | ||
pub last_checked_github: Option<String>, | ||
pub last_hecked_gitlab: Option<String>, | ||
pub last_hecked_pypi: Option<String>, | ||
pub last_checked_pending_pr: Option<String>, | ||
pub last_update_attempt: Option<String>, | ||
pub pending_pr: Option<i32>, | ||
pub pending_pr_owner: Option<String>, | ||
pub pending_pr_branch_name: Option<String>, | ||
pub last_update_log: Option<String>, | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// @generated automatically by Diesel CLI. | ||
|
||
diesel::table! { | ||
packages (id) { | ||
id -> Text, | ||
attr_path -> Text, | ||
version_nixpkgs_master -> Nullable<Text>, | ||
version_nixpkgs_staging -> Nullable<Text>, | ||
version_nixpkgs_staging_next -> Nullable<Text>, | ||
version_repology -> Nullable<Text>, | ||
version_github -> Nullable<Text>, | ||
version_gitlab -> Nullable<Text>, | ||
version_pypi -> Nullable<Text>, | ||
project_repology -> Nullable<Text>, | ||
nixpkgs_name_replogy -> Nullable<Text>, | ||
owner_github -> Nullable<Text>, | ||
repo_github -> Nullable<Text>, | ||
owner_gitlab -> Nullable<Text>, | ||
repo_gitlab -> Nullable<Text>, | ||
last_checked_repology -> Nullable<Text>, | ||
last_checked_github -> Nullable<Text>, | ||
last_hecked_gitlab -> Nullable<Text>, | ||
last_hecked_pypi -> Nullable<Text>, | ||
last_checked_pending_pr -> Nullable<Text>, | ||
last_update_attempt -> Nullable<Text>, | ||
pending_pr -> Nullable<Integer>, | ||
pending_pr_owner -> Nullable<Text>, | ||
pending_pr_branch_name -> Nullable<Text>, | ||
last_update_log -> Nullable<Text>, | ||
} | ||
} |